상세 컨텐츠

본문 제목

[이넘]1

자바

by esoesmio 2023. 4. 5. 09:01

본문

public class home9 {


    public static void main(String[] args) {
        cute c = new cute();
c.print("kor");


    }
}
enum country{
    KOR("한국", "불고기");

    public String getCountryname() {
        return countryname;
    }

    public void setCountryname(String countryname) {
        this.countryname = countryname;
    }

    public String getCountryfood() {
        return countryfood;
    }

    public void setCountryfood(String countryfood) {
        this.countryfood = countryfood;
    }

    String countryname;
    String countryfood;
    country(String countryname, String countryfood){

        this.countryfood = countryfood;
        this.countryname = countryname;
    }


}

class cute{
    public void print(String ccountry){
country c = country.valueOf(ccountry.toUpperCase());
        System.out.println(c.getCountryname() + "의 대표음식은 " + c.getCountryfood());

    }

}

관련글 더보기

댓글 영역