학교
학생, 선생님, 과목
class School {
String schoolName;
Student[] students;
Theacer[] teachers;
Course[] courses;
addStudents();
removeStudents();
}
class Student {
String name;
int age;
study();
enrollCourse();
dropCourse();
takeExam();
}
class Teacher {
String name;
int age;
teach();
}
class Course {
String courseName;
Teacher teacher;
addStudents();
removeStudents();
}
팀, 선수, 감독, 경기
Type variableName
ex) String name, int age, int goal, char name
---
타입에 대해서 알아보자.
- 기본형 타입 (primitive type) - 8가지
- int(4), boolean(1), byte(1), short,(2) char(2), long(8), float(4), double(8)
- 실제 값을 저장하는 공간으로 "스택" 메모리
- 참조형 타입 (reference type)
- 기본형 타입을 제외한 모든 타입
- String, array, class 만드는 객체
- 값이 저장되어 있는 곳의 주소 값을 저장하는 공간으로 "힙" 메모리
---
class Student {
String name = new String("김동욱");
int age = 29;
}
카테고리 없음