728x90
반응형
C언어: 절차 / 구조적 프로그래밍
fly(){
travelToAirport();
findChecklnCounter();
checkln()
passSecuiryCheck();
waitForBoardingCall();
boardTheFlight();
wishTheAirHostess();
takeOff();
haveFun();
landing();
}
Java: 객체지향 프로그래밍
Aeroplane{
airline, make, type, position //data
takeoff(), land(), cruise() //actions
}
AirHostess{
name, address //data
wish(), serve() //actions
}
Passenger{
name, address //data
tajeCab(), checkin(), walk(), smile() //aciton
}
Class: 객체가 갖고 있는 데이터와 객체에 행할 수 있는 동작이 무엇인지 규정하는 것.
ex) 행성(class), 지구(class의 인스턴스)
Online Shopping System
Customer{
name, adress
login(), logout(), selectProduct(product)
}
Shopping Cart{
items
add(item), remove(item)
}
Product{
name, price, quantityAvailable
order(), changePrice()
}
728x90
반응형
'이론 > Java' 카테고리의 다른 글
| Java, BigDecimal (1) | 2023.08.11 |
|---|---|
| public static void main(String[] args) (1) | 2023.08.07 |
| JVM(Java Virtual Machine) vs JRE vs JDK (0) | 2023.07.24 |
| Method Syntax (0) | 2023.07.24 |
| Jshell (0) | 2023.07.23 |