프로그래밍이란, 사람이 잘 못하는 일을 기계가 대신하게끔 만들어서 자동화 하는 것이다.
자바를 이용해서 사물을 제어하여 우리의 삶을 획기적으로 높이는 프로그램과 어플리케이션을 만들어보자
import org.opentutorials.iot.Elevator;
import org.opentutorials.iot.Lighting;
import org.opentutorials.iot.Security;
// import를 통해 다른 클래스를 불러올 수 있다.
public class OKJavaGoInHome {
public static void main(String[] args) {
// String이라는 데이터 타입을 변수 id로 지정하고, "내용에는 JAVA APT 507"이 들어있음
String id = "JAVA APT 507";
// Elevator call
// myElevator 라는 변수는 반드시 Elevator라는 데이터 타입에 해당되는 데이터만 올 수 있다.
// 위에서 import를 통해 org폴더의 Elevator를 불러옴
Elevator myElevator = new Elevator(id);
myElevator.callForUp(1);
// Security off
Security mySecurity = new Security(id);
mySecurity.off();
//Light on
Lighting hallLamp = new Lighting(id+" / Hall Lamp");
hallLamp.on();
Lighting floorLamp = new Lighting(id+" / Floor Lamp");
floorLamp.on();
}
}