class, Object, Instance의 상호관계
3개 모두 비슷한 개념으로, 모두 객체를 나타내는 용어 class - 객체를 모델링 하는 도구(설계도) Object - 클래스를 통해서 선언되는 변수 Instance - 객체생성에 의해 메모리(Heap Memory)에 만들어진 객체 public class ClassDbIN { public static void main(String[] args) { Student st1; Student st2; Student st3; st1 = new Student("na","a",12,"32",12,"010"); st2 = new Student("nada","d",32,"30",32,"011"); st3 = new Student("naa","c",52,"31",14,"012"); System.out.println(st1..
2023. 11. 29.
배열과 클래스
배열은 같은 형을 연속적인 데이터를 가지고 있음 (동일한 데이터) 클래스는 다른 형의 데이터를 가지고 있음(이질적인 데이터) ↓기본배열 ↓ float[] arr = new float[4]; arr[0] = 1.4f; ↓객체배열↓ Student[] std = new Student[4]; std[0]=new Student("홍길종","전기",21,"이메일",20230001,"010-1234-1234"); 객체배열 실습 public class StudentArrTest { public static void main(String[] args) { Student[] st = new Student[4]; st[0]=new Student("홍길동","컴공",14,"email",20230001,"010-0001-000..
2023. 11. 27.