ALL

Language/JAVA
부모의 private 타입의 멤버변수 count 는 클래스 내에 메소드를 통해서 접근이 가능함 setter 와 getter 를 사용해 접근하고 return 해주기 둘다 첫번째로 와야함, 동시에 호출 x this => 나의 생성자 호출 super => 부모의 생성자 호출 package modifier; class Fruit { private int count; public Fruit() {} // 자식때문에 넣어준 것 public Fruit(int count) { this.count = count; } public void showCount() { System.out.println("현재 남은 개수는 " + this.count + "입니다."); } public void setCount(int count)..
Language/JAVA
Jar(Java Archiver) = 자바에서 쓰는 압축 파일 https://velog.io/@wpdlzhf159/Java-jar%EB%9E%80 [Java] jar 파일이란? 간단한 jar 파일 생성을 통해 자바 애플리케이션 배포시 사용되는 jar파일에 대해 알아보고 zip과의 차이점은 무엇이 있을지 알아봅시다! velog.io
Language/JAVA
📍 24.04.11(목) ~ 24.04.12(금) : 상속, 오버라이딩, IS-A/HAS-A 관계, 다형성, package/import/접근제어자, 추상클래스, 인터페이스, try ~ catch ~ finally, throws, Thread📍 24.04.22(월) ~ 24.04.26(금) : singleton, enum, generic 📍 24.04.11(목) 12일차this / this() / super / super()this참조변수 ex) this.멤버변수, this.멤버메소드()this.멤버변수this.멤버메소드()this()생성자 호출 super참조변수super.부모의 멤버변수super.부모의 멤버메소드()super()부모의 생성자 호출 ..
Language/JAVA
public class ParameterQuiz { public static String concat(String ... args) { // 초기값 설정 String reslut = ""; for (String ar: args) { reslut += ar; } return reslut; } public static void main(String[] args) { String[] one = {"하나", "둘", "셋"}; System.out.println(concat(one)); // 하나둘셋 // "넷", "다섯", "여섯 System.out.println(concat("넷", "다섯", "여섯")); // 넷다섯여섯 } }
Language/JAVA
내부 접근 : 객체 안에서 돌 때 외부 접근 : 외부에서 접근할 때 class Student { // field : 필드, 멤버변수 int age; String name; // constructor Student(int age, String name) { this.age = age; this.name = name; } // method void showInfo() { System.out.println("나이 : " + this.age); System.out.println("이름 : " + this.name); } } public class ArrayEx02 { public static void main(String[] args) { // 객체 배열 : 1차원 배열 // 타입[] 배열명 = new 타입[길..
Language/JAVA
public class ArrayEx03CleanCode { public static void main(String[] args) { // [ 1차원 배열 ] 길이가 1개인 배열 // 자료형[] 참조변수 = new 자료형[열길이]; // 자료형[] 배열명 = new 자료형[열길이]; //int[] arr = new int[5]; int[] arr = new int[] {1, 3, 5, 7, 9}; System.out.println("arr >> " + arr + "\n"); // [ 2차원 배열 ] 길이가 2개인 배열 // 배열 생성과 동시에 초기화 // int[][] arr2 = new int[2][3]; int[][] arr2 = {{2, 3, 4},{8}}; // 2. 값 설정 //arr2[0][0..
Language/JAVA
public class ArrayEx03 { public static void main(String[] args) { // [ 1차원 배열 ] 길이가 1개인 배열 int[] arr = new int[5]; // 자료형[] 참조변수 = new 자료형[열길이]; System.out.println("arr >> " + arr); // [ 2차원 배열 ] 길이가 2개인 배열 int[][] arr2 = new int[2][4]; // 자료형[][] 참조변수 = new 자료형[행길이][열길이]; System.out.println("arr2 >> " + arr2); // 2차원 배열의 참조변수 // arr2 : 참조변수 - 행의 시작 주소 // arr2[0]: 참조변수 - 첫 번째 1차원 배열의 시작 주소 // ar..
Language/JAVA
class Student { // field : instance field int age; String name; // constructor Student() {} Student(int age) { this.age = age; } // setter void setAge(int age) { this.age = age; } void showInfo() { System.out.println("나이 >> " + age); } } public class ConstructorEx01 { public static void main(String[] args) { // 홍길동 객체(인스턴스) 생성 System.out.println("** 홍길동 학생 정보 **"); Student hong = new Student(25)..
print(blue)