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
'공부(Study)' 카테고리의 다른 글
First Win32 Project (0) | 2017.02.15 |
---|---|
Start studying MFC (0) | 2017.02.15 |
Sudoku Game with C++ - day 3 (0) | 2016.07.21 |
Sudoku Game with C++ - day 2 (0) | 2016.07.08 |
Sudoku Game with C++ - day1 (0) | 2016.07.06 |