클래스1 [JAVA] 클래스와 데이터1 1. 클래스가 필요한 이유 * 문제 : 과일 두 개의 특징(이름, 가격, 색깔)를 출력하는 프로그램을 만들기 1) 변수 사용 public class FruitStart1 { public static void main(String[] args) { String fruitName1 = "사과"; int fruitPrice1 = 1500; String fruitColor1 = "Red"; String fruiteName2 = "바나나"; int fruitePrice2 = 2000; String fruitColor2 = "Yellow"; System.out.println("이름:" + fruitName1 + " 가격:" + fruitPrice1 + " 색깔:" + fruitColor1); System.out.p.. 📕JAVA 2023. 6. 13. 이전 1 다음