본문 바로가기

Language/JAVA42

[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.
[JAVA] 2-5~6 연산자 == , equals 논리연산자 true , false && || 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 2-5 == vs equals primitive: 원시 데이터 타입 non primitive: 원시 데이터 타입이 아닌 것 == 동등 비교연산자는 값이 같은 곳에 위치하고 있는지를 따짐 원시 데이터 타입이 아닌 것은 equals로. 2-6 논리연산자 (logical operator) package javaChapter2_6; public class LogicalOperatorApp { public static void main(String[] args) { System.out.println(1 == 1); // AND System.out.println(true && true); // true System.out.println(true && false).. 2022. 2. 3.
[JAVA] 2-4.1~4.3 조건문 (if , else if, else) 부스트코스 생활코딩 [쉽게 배우는 자바2] 공부 기록 2-4.1 조건문 형식 (Conditional Statement) package javaChapter2_4; public class IfApp { public static void main(String[] args) { System.out.println("a"); // if (false) { // System.out.println(1); // } else { // if (true) { // System.out.println(2); // } else { // System.out.println(3); // } // } if (false) { System.out.println(1); } else if (true) { System.out.println(2);.. 2022. 2. 2.