๋ณ์์ ๋ฆฌํฐ๋ด int i=1; ์ ์ ํ์
๋ณ์ i๋ฅผ ์ ์ธํจ๊ณผ ๋์์ 1๋ก ์ด๊ธฐํ int : ์ ์ ํ์
(type)์ ๋ํ๋ด๋ ํค์๋ ํค์๋๋ java์ธ์ด์์ ์ ํ ์์ฝ์ด๋ฅผ ๋งํ๋ค. class, public, static, while ๋ชจ๋ ํค์๋ i : ๋ณ์ i, ํ๋์ ๊ฐ์ ๊ฐ์ง ์ ์๋ ๊ณต๊ฐ 1: ์ ์ ๋ฆฌํฐ๋ด 1. ๋ฆฌํฐ๋ด์ด๋ ๋ณ์์ ์
๋ ฅ๋๋ ๊ฐ ๊ธฐ๋ณธํ ํ์
: ์๋ฌธ์๋ก ์์, ๋ฉ๋ชจ๋ฆฌ ์์ ๊ฐ ์ ์ฅ ์ ์ํ์
(byte) : short(2), int(4), long(8) ์ค์ํ์
: float, double ๋ฌธ์ 1๊ฐ : char boolean : ์ฐธ(true) or ๊ฑฐ์ง(false) ์ฐธ์กฐํ(reference)=๊ธฐ๋ณธํ์ด ์๋ ํ์
(๋๋ฌธ์๋ก ์์): class, interface,๋ฐฐ์ด ๋ฑ.. ๊ฐ์ ์ฐธ์กฐ ๋ณ์๋ช
..
๐ผ๋ฐฑ์ค๋/Java ๋ฌธ๋ฒ
public class _02_ArrayLoop { public static void main(String[] args) { //๋ฐฐ์ด์ ์ํ String[] coffees = {"์๋ฉ๋ฆฌ์นด๋
ธ","์นดํ๋ชจ์นด","๋ผ๋ผ","์นดํธ์น๋
ธ"}; for (int i = 0; i
package chap_05; public class _01_Array { public static void main(String[] args) { //๋ฐฐ์ด: ๊ฐ์ ์๋ฃํ์ ๊ฐ ์ฌ๋ฌ ๊ฐ๋ฅผ ์ ์ฅํ๋ ์ฐ์๋ ๊ณต๊ฐ String coffeeRoss = "์๋ฉ๋ฆฌ์นด๋
ธ"; String coffeeRachel = "์นดํ๋ชจ์นด"; String coffeeChandler = "์นดํ๋ผ๋ผ"; String coffeeMonica = "์นดํธ์น๋
ธ"; System.out.println(coffeeRoss + " ํ๋"); System.out.println(coffeeRachel + " ํ๋"); System.out.println(coffeeChandler + " ํ๋"); System.out.println(coffeeMonica + ..
import org.w3c.dom.ls.LSOutput; public class _11_Continue { public static void main(String[] args) { //Continue //์นํจ ์ฃผ๋ฌธ ์๋์ค์ ๋
ธ์ผ ์๋์ด ์๋ค๊ณ ๊ฐ์ //for๋ฌธ int max = 20; //์ต๋ ์นํจ ํ๋งค ์๋ int sold = 0; //ํ์ฌ ์นํจ ํ๋งค ์๋ int noshow = 17; //๋๊ธฐ๋ฒํธ 17๋ฒ ์๋์ด ๋
ธ์ผ for (int i=1; i
public class _10_Break { public static void main(String[] args) { //Break //์นํจ ์ง์์ ๋งค์ผ 20๋ง๋ฆฌ๋ง ํ๋งค //for๋ฌธ int max =20; for (int i =1; i
public class _09_MultipleTable { public static void main(String[] args) { //๊ตฌ๊ตฌ๋จ for (int i=2;i
public class _08_NesteedLoop { public static void main(String[] args) { //์ด์ค ๋ฐ๋ณต๋ฌธ //๋ณ (*) ์ฌ๊ฐํ /* ***** ***** ***** ***** ***** */ for (int i=0;i
public class _07_DoWhile { public static void main(String[] args) { //๋ฐ๋ณต๋ฌธ do-while int distance = 25; //์ ์ฒด ๊ฑฐ๋ฆฌ 25 int move = 0; //ํ์ฌ ์ด๋ ๊ฑฐ๋ฆฌ 0 int height = 2; //ํค 2 while (move + height < distance){ System.out.println("๋ฐ์ฐจ๊ธฐ๋ฅผ ํฉ๋๋ค."); System.out.println("ํ์ฌ ์ด๋ ๊ฑฐ๋ฆฌ :" + move ); move += 3; //3m ์ด๋ } System.out.println("๋์ฐฉํ์ต๋๋ค."); //do while ๋ฐ๋ณต๋ฌธ do{ System.out.println("๋ฐ์ฐจ๊ธฐ๋ฅผ ๊ณ์ ํฉ๋๋ค."); System.out.println("..