๐ป ํ๋ก๊ทธ๋๋ฐ (23) ์ธ๋ค์ผํ ๋ฆฌ์คํธํ 2-12 ๋ฐ๋ณต๋ฌธ while 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162package pack; public.. 2-11 ์กฐ๊ฑด ๋ฐ๋ณต๋ฌธ if II 12345678910111213141516171819202122232425262728293031323334353637package pack; public class Test11For { public static void main(String[] args) { // for : continue, break for (int i = 1; i 2-9 ์กฐ๊ฑด ํ๋จ๋ฌธ switch II 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950package pack; public class Test9switch { public static void main(String[] args) { // Switch Test //๋ฌธ์๋น๊ต๋ ๊ฐ๋ฅ double su1 = 10.5, su2 = 5.6, result = 0.0; char op = '+'; switch (op) { case '+': result = su1 + su2; break; case '-': result = su1 - su2; break; case '*': result = su1 * su2; break; case '/': resul.. 2-8 ์กฐ๊ฑด ํ๋จ๋ฌธ switch 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109package pack; import java.util.Scanner; public class Test8switch { public static void main(String[] args) { // ์กฐ๊ฑด ํ๋จ๋ฌธ Switch๋ฌธ int nai =42; nai = nai / 10 * 10; //System.out.printl.. 2-7 ์กฐ๊ฑดํ๋จ๋ฌธ if 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485package pack; import java.util.Scanner; public class Test7if { public static void main(String[] args) throws Exception{ // ์กฐ๊ฑด ํ๋จ๋ฌธ if int num = 2; if(num >= 3){ System.out.println("ํฌ๊ตฐ์ฉ"); System.out.println("์ฐธ์ผ ๋"); } System.out.println(".. 2-6 ํฐ ์ ์ Big Decimal 12345678910111213141516171819202122232425262728293031package pack; import java.math.BigDecimal; public class Test6bigdecimal { public static void main(String[] args) { // ์ปด์ double ์ฐ์ฐ์ฒ๋ฆฌ ์ค๋ฅ //double a = 1.5; //double b = 1.2; double a = 2.0; double b = 1.1; System.out.println(a + b); System.out.println(a - b); //๊ฒฐ๊ณผ๊ฐ .899999999999999๋ก ๋์ค๋ ๋ฐ ์ด๊ฒ์ ๋น๋จ JAVA๋ง์ ๋ฌธ์ ๋ ์๋๋ค System.out.println(); BigDecimal d1.. 2-5 ํ๋ก๊ทธ๋จ๋์ค ํค๋ณด๋ ์ ๋ ฅ๊ฐ ๋ฐ๊ธฐ 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748package pack; import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.Scanner; public class Test5io { public static void main(String[] args) throws Exception{ // ํ๋ก๊ทธ๋จ ์งํ ๋์ค ์ธ๋ถ์์ ๊ฐ ์ป๊ธฐ (์ ์ถ๋ ฅ) if(args.length == 0){ System.out.println("์ธ๋ถ์์ ๊ฐ ์ป๊ธฐ ์คํจ!"); System.exit(0); //์์ฉํ๋ก๊ทธ๋จ์ ๊ฐ์ ๋ก ๋ฌด์กฐ๊ฑด์ ์ข ๋ฃ }.. 2-4 ๋ ผ๋ฆฌ์ฐ์ฐ์ 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354package pack; public class Test4 { public static void main(String[] args) { // ๋ ผ๋ฆฌ ์ฐ์ฐ์ ์ฒ๋ฆฌ ์ ์ฃผ์ ์ฌํญ boolean a = false, b = true, c; c = a || b; System.out.println(c); c = a && b; System.out.println(c); System.out.println(); boolean b1, b2; b1 = aa(); System.out.println(b1); System.out.println(bb()); S.. ์ด์ 1 2 3 ๋ค์