본문 바로가기

JAVA/기초다지기

IOT Programming

 

 

- 사물을 java로 제어하기 -

import org.opentutorials.iot.Elevator;
import org.opentutorials.iot.Lighting;
import org.opentutorials.iot.Security;


public class OkJavaGoinHome {

	public static void main(String[] args) {
		
		String id = "SOO APT 306";
		
		// 먼저 내가 뭘 할것인지 생각하고 정리해야함. 시간 순서에 따라 뭐가 필요한지.
		
		//Elevator call
		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();
		
		

	}

}

 

* 중복되는 부분은 변수처리 -> String id = "SOO APT 306";    

 

- class 생성 후 만약 import가 안된다면 내가 생성할때 name칸이 아닌 다른곳에 이름을 입력하지 않았는지 확인.

-  import 를 활용을 하여 필요한 클래스를 끌어올 수 있다.이것을 통해 길게 쓸 필요없이 사용할 수 있다.

 

**프로그래밍

: 프로그램 말의 어원에는 음악회 같은 것을 보면 음악회에서 공연될 공연들이 시간의 순서에 따라서 연주되는것을 프로그램이라고 해서, 시간의 순서에 따라서 실행되는것을 프로그램이라고 칭했다.

 

이것을 시간 순서대로, 논리적인 순차대로 자동화시키는것이 바로 “프로그래밍”이며,

그 자동화 프로그램을 짜는 것은 프로그래머이다.

 

 

 

 

'JAVA > 기초다지기' 카테고리의 다른 글

입력과 출력  (0) 2021.02.17
디버거  (0) 2021.02.17
데이터 타입의 변환  (0) 2021.02.16
변수의 효용  (0) 2021.02.16
변수의 정의  (0) 2021.02.14