-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods.java
More file actions
39 lines (27 loc) · 826 Bytes
/
Copy pathmethods.java
File metadata and controls
39 lines (27 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//import java.util.Scanner;
public class methods {
public static void main(String[] args) {
int age = 3;
String name = "ADKhsjkd";
birthday(name,age);
double number = 3.0;
number = square(number);
System.out.println(number);
// Overload methods
System.out.println(add(1, 2));
System.out.println(add(1, 2,3));
}
static void birthday(String name, int age){
System.out.printf("Happy Birthday %s ! You are %d Years Old!\n",name,age);
}
static double square(double num){
return num*num;
}
//overload methods
static int add(int a, int b){
return a+b;
}
static int add(int a, int b, int c){
return a+b+c;
}
}