-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelloWorld.java
51 lines (45 loc) · 866 Bytes
/
HelloWorld.java
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
40
41
42
43
44
45
46
47
48
49
50
51
public class HelloWorld {
public static void main(String args[]){
mutiArg();
mutiArg(3,4,5,1);
mutiArg(2,7);
}
private static int addition(int x, int y){
x=x+y;
return x;
}
public static void testX(){
int x=4;
int y=2;
System.out.println(x+" "+y);
x=addition(x,y);
System.out.println(x+" "+y);
}
public static void printTree(){
for(int i=0;i<5;i++){
for(int k=0;k<(5-i);k++){
System.out.print(" ");
}
for(int j=0;j<i+1;j++){
System.out.print("* ");
}
System.out.println();
}
}
public static void testArray(){
int myArray[] = {1,3,5};
fun(myArray);
for(int i=0;i<myArray.length;i++){
System.out.println(myArray[i]);
}
}
private static void fun(int temp[]){
temp[0]=120;
}
public static void mutiArg(int... arg){
for(int x : arg){
System.out.print(x);
}
System.out.println();
}
}