공부(Study)
Java Study - day1
Jae Ryun, Buster, Chung
2016. 7. 6. 11:18
Install Eclipse
create package & class
Helloworld class
package org.buster.javatutorials.eclipse;
public class Helloworld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
String class
print string that includes ""
public class String {
public static void main(java.lang.String[] args) {
System.out.println("egoing said\n\"Welcome programming world\"");
}
}
Variables
Using variables increases recyclability of the codes
For example,
System.out.println(
100
+
10
);
System.out.println((
100
+
10
) /
10
);
System.out.println(((
100
+
10
) /
10
) -
10
);
System.out.println((((
100
+
10
) /
10
) -
10
) *
10
);
If I want to change first number 100 to 1000, I have to change all 4 lines. However, if I used variable for 100, I have to change only 1 line. See the below
int
a =
100
; //chage to int a = 1000;
System.out.println(a +
10
);
System.out.println((a+
10
) /
10
);
System.out.println(((a +
10
) /
10
) -
10
);
System.out.println((((a +
10
) /
10
) -
10
) *
10
);
So, using variables makes it easy for developer to maintenance the codes