Class
-
Java - ThreadJava 2018. 1. 30. 14:57
// Thread는 어떤 program을 실행 하게 해주는 원동력이다// 대표적으로 main(String[] args)로 실행 한다. // process는 1개 이상의 thread로 구성되어 있다.// process는 thread로 구성 된다.// 메모리 공유 부분에서 process는 메모리 공유가 안되지만,// Thread는 메모리 공유가 된다. // main method는 main thread를 생성 한다.// 처리가 버거우면 work thread를 생성할 수 있다.// 이것을 multi thread라 한다. // Runnable Interface, Thread Class 상속으로 생성할 수 있다. public class Main { public static void main(..
-
Java - GenericJava 2018. 1. 24. 08:44
Generic을 사용하면 다시 원형으로 돌아가기 위한 Casting절차를 없앨 수 있다. public class Box { private Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } public class Main { public static void main(String[] args) { Box box = new Box(); // Box안에는 무엇이 들어갈ㅈ ㅣ몰라서 Object로 선언 box.setValue(1234); int value = (int) box.get..
-
Java - ClassJava 2018. 1. 16. 12:34
public class Main { public static void main(String[] args) { // Student Class를 복사해서 std라는 변수에 담는다. Student std = new Student(); Student std2 = new Student(); System.out.println(std); System.out.println(std2); } } // std과 std2 클래스는 다르다 public static void main(String[] args) { String a =""; String b = ""; Robot bot = new Robot(a, b); System.out.println(bot.name); System.out.println(bot.goal); } pu..