๊ณ„๋ž€์†Œ๋…„ 2023. 7. 5. 23:37
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 + " ํ•˜๋‚˜");
        System.out.println("์ฃผ์„ธ์š”");

        //๋ฐฐ์—ด ์„ ์–ธ ์ฒซ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•
        //String[] coffees = new String[4];

        //๋‘ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•
        //String coffees[] = new String[4];
        //coffees[0] = "์•„๋ฉ”๋ฆฌ์นด๋…ธ";
        //coffees[1] = "์•„๋ฉ”๋ฆฌ์นด๋…ธ";
        //coffees[2] = "์•„๋ฉ”๋ฆฌ์นด๋…ธ";
        //coffees[3]] = "์•„๋ฉ”๋ฆฌ์นด๋…ธ";

        //์„ธ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•
        //String[] coffees = new String[]{"์•„๋ฉ”๋ฆฌ์นด๋…ธ","์นดํŽ˜๋ชจ์นด","๋ผ๋–ผ","์นดํ‘ธ์น˜๋…ธ"};

        //๋„ค ๋ฒˆ์งธ ๋ฐฉ๋ฒ•
        String[] coffees = {"์•„๋ฉ”๋ฆฌ์นด๋…ธ","์นดํŽ˜๋ชจ์นด","๋ผ๋–ผ","์นดํ‘ธ์น˜๋…ธ"};

        System.out.println("-------------------");

        //์ปคํ”ผ ์ฃผ๋ฌธ
        System.out.println(coffees[0]+" ํ•˜๋‚˜");
        System.out.println(coffees[1]+" ํ•˜๋‚˜");
        System.out.println(coffees[2]+" ํ•˜๋‚˜");
        System.out.println(coffees[3]+" ํ•˜๋‚˜");
        System.out.println("์ฃผ์„ธ์š”");

        //๋‹ค๋ฅธ ์ž๋ฃŒํ˜•?
        int[] i = new int[3];
        i[0] =1;
        i[1] =2;
        i[2] =3;

    }
}