본문 바로가기

SOMEDAY/JAVA92

[JAVA] 객체지향 프로그래밍 7~9 생성자 this / 클래스화 인스턴스화 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 7. 생성자와 this package javaChapter2_10; public class MyOOP { public static void main(String[] args) { Print p1 = new Print("----"); p1.A(); } } package javaChapter2_10; class Print { public String delimiter = ""; public Print(String _delimiter) { //생성자 delimiter = _delimiter; } public void A() { System.out.println(delimiter); System.out.println("A"); System.out.printl.. 2022. 2. 9.
[JAVA] 객체지향 프로그래밍 4~6 class instance static 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 4-1 클래스 (존재 이유와 기본형식) package javaChapter2_10; class Print { public static String delimiter = ""; public static void A() { System.out.println(delimiter); System.out.println("A"); System.out.println("A"); } public static void B() { System.out.println(delimiter); System.out.println("B"); System.out.println("B"); } } public class MyOOP { public static void main(String[.. 2022. 2. 8.
[JAVA] 객체지향 프로그래밍 1~3 클래스, 인스턴스, 변수, 메소드 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 1. 수업소개 JAVA object Oriented Programming 클래스를 이용해서 프로그램의 구조를 만들어 가는 방식 2. 남의 클래스 남의 인스턴스 package javaChapter2_10; import java.io.FileWriter; import java.io.IOException; public class OthersOOP { public static void main(String[] args) throws IOException { // class : System, Math, FileWriter // instance : f1, f1 System.out.println(Math.PI); // Math라는 클래스에, PI라는 변수가 있는 .. 2022. 2. 7.
[JAVA] 메소드 1~9 method , class, static, instance 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 1. 수업소개 method = function = subroutine = procedural procedural programming (절차 지향 프로그래밍) 자바에서는 method programming 작은 부품을 만들고, 결합하여 만든다. method와 variable을 결합하여 class로 정리정돈 정리정돈 상자를 통해 구조화하여 만드는 게 object oriented programming (객체 지향 프로그래밍) 2. 이미 익숙한 메소드 public class FirstMethod { public static void main(String[] args) { System.out.println("Hello Method"); System.out.pr.. 2022. 2. 6.
[JAVA] 2-8.1~8.2 종합응용 2 (배열, 조건문, 반복문, scanner) 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 2-8.1 종합응용 1 package javaChapter2_8; public class AuthApp3 { public static void main(String[] args) { String[] users = {"egoing", "jinhuck", "youbin"}; String inputId = args[0]; boolean isLoginged = false; for (int i = 0; i < users.length; i++) { String currentId = users[i]; if (currentId.equals(inputId)) { isLoginged = true; break; } } System.out.println("Hi,"); if.. 2022. 2. 5.
[JAVA] 2-7.1~7.3 반복문 (while, for) 배열 (Array) 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 2-7.1 반복문 (Looping statement) package javaChapter2_7; public class LoopApp { public static void main(String[] args) { System.out.println(1); System.out.println("=== while ==="); int i = 0; while (i < 3) { System.out.println(2); System.out.println(3); // i = i + 1; i++; } System.out.println("=== for ==="); for (int j = 0; j < 3; j++) { System.out.println(2); System.o.. 2022. 2. 4.