-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTest.java
More file actions
34 lines (22 loc) · 723 Bytes
/
Test.java
File metadata and controls
34 lines (22 loc) · 723 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
package datatype;
public class Test {
public static void main(String[] args) {
int n1 = 100;
int n2 = 102;
int res = add(n1,n2);
System.out.println(res); // 202
System.out.println(n1); // 100
Human human = new Human("Saeed",21);
printHumanData(human); // Saeed -> 21
System.out.println(human.getAge()); // 26
}
private static void printHumanData(Human human){
System.out.println(human.getName()+" -> "+human.getAge());
human.setAge(26); // will modify main object
}
private static int add(int num1, int num2){
int res = num1+num2;
num1 = 25; //won't affect real data
return res;
}
}