본문 바로가기

TIL/JAVA24

23.05.04 package nadocoding.Chap_07; public class BlackBox { // _02 String modelName; // 모델명 String resolution; // 해상도 int price; // 가격 String color; // 색상 int serialNumber; // 시리얼 번호 static int counter = 0; // 시리얼 번호를 생성해주는 역할 (처음엔 0이였다가 증감연산자로 증가) // _03 static boolean canAutoReport = false; // 자동 신고 가능 // _08 BlackBox() { // 생성자 // 인스턴스가 생성될 때 자동으로 실행되는 메소드 // System.out.println("기본 생성자 호출"); // this... 2023. 5. 4.
23.05.03 2차원 배열, 다차원 배열, 순회 package nadocoding.Chap_04; public class _11_Continue { public static void main(String[] args) { // Continue // 치킨 주문 손님중에 노쇼 손님이 있다고 가정 // For int max = 20; int sold = 0; int noShow = 17; for (int i = 1; i 2 * 2 = 4 // 3 -> 3 * 3 = 9 // 2 = Argument, 인수 power(2); // 2 의 2 승은 4 power(3); // 3 의 2 승은 9 powerByExp(3,3); // 3 의 3 승은 27 powerByExp(2,5); // 2 의 5 승은 32 powerByExp(1.. 2023. 5. 3.
23.05.02 continue package nadocoding.Chap_04; public class _11_Continue { public static void main(String[] args) { // Continue // 치킨 주문 손님중에 노쇼 손님이 있다고 가정 // For int max = 20; int sold = 0; int noShow = 17; for (int i = 1; i 2023. 5. 2.
23.05.01 문자열 관련 함수(.length(), .indexOf(), .substring(), ...) package nadocoding.Chap_03; public class _01_String1 { public static void main(String[] args) { String s = "I like Java and Python and C."; System.out.println(s); // 문자열의 길이 System.out.println(s.length()); // 29 // 대소문자 변환 System.out.println(s.toUpperCase()); // I LIKE JAVA AND PYTHON AND C. System.out.println(s.toLowerCase()); // i like java a.. 2023. 5. 1.