-
[30일코딩] Heaps and Binary Search개발입문/JAVA 2017. 5. 9. 11:40
Graphs & Trees 1) Root / Node / Leaf루트 노드에서 시작 각 노드들로 이동한다.루트가 아닌 자식이 없는 노드는 leaf node 라고 부른다. 2) Binary: Left and Right 각 node는 최대 2개의 노드 left, right child만 가진다. 3) Parent / Children부모 노드와 자식 노드 순서가 있고 이것은 나무 일부분을 이룬다. sub-tree 4) Recursive그리고 이 sub-tree 들은 반복된다. 5) Height of Trees https://www.tutorialspoint.com/data_structures_algorithms/tree_data_structure.htm Heap힙(heap)은 최댓값 및 최솟값을 찾아내는 연산을..
-
[30일코딩] Generic 제너릭개발입문/JAVA 2017. 5. 9. 10:48
Java는 타입에 까다로운 언어이다.컴파일할 때 서로 같은 타입을 가리키는 지를 엄격하게 확인한다. 그러나 같은 클래스, 같은 메소드를다른 타입으로 재활용하고 싶을 경우를 위해 "제너릭" 이 있다. - Reuse the same class and method throughout datatype with generics- Compiler Type-checking public class Nodepublic E getRandomAnimal(E[] element) {} E 는 Animal 클래스를 상속받은 객체라면 어느것이든 들어올 수 있다.E 는 데이터타입이 들어올 수있는 곳: 리턴타입, 매개변수, 메소드 내 어느 곳이든 사용 가능하다.E 는 객체를 상속해야한다. (즉 int 대신 Integer를 사용해야한다..
-
[30일코딩] Queue and Stack개발입문/JAVA 2017. 5. 7. 23:59
큐와 스택Queues & Stacks Interface Queue 놀이동산에서 대기줄 빠지는 모양먼저 온 사람이 먼저 나가는 방식 - FIFO (First In First Out)- enqueue / dequeue- isEmpty, size, peek etc.- Queue's subclass includes LinkedList Class Stack 카드덱 or 함수호출하는 스택먼저낸 카드는 밑에 쌓인다. (나중에 사라진다.) - LIFO Last In First Out- peek / push / pop- empty, size (참고)LinkedList 와 달리 traverse 할 수 없다. 순서를 빼먹고 지나갈 수 없다!!
-
[30일코딩] Exception개발입문/JAVA 2017. 5. 7. 22:23
Exceptions 예외 1) Checked Exceptions - compile error- can not start the application 2) Unchecked Exceptions (Runtime Exception)- logical error - terminate applications abnormally. Error Handling 예외 처리 컴퓨터에서 예외는 꼭 처리되어야한다.어디에서든가. 예외가 발생할 일말의 가능성이라도 있다면!!!! 예외를 처리하거나 try-catch 문예외를 선언해야 한다. throws 키워드(이렇게 메소드에 선언된 예외도 호출하는 쪽에서 꼭 처리되어야한다.) 1) Try-catch-(finally) block- handle this error right away t..
-
[30일코딩] LinkedList개발입문/JAVA 2017. 5. 7. 20:09
Day 15. LinkedList 에서는Data Structure 에서 알고리즘을 직.접. 짜보는 시간을 가졌다. 어떻게 구현되는지 살짝 맛보기에 가까운 강의였는데~그래도 뭔가 신기하고 신났다! (신난다신난다!) 컴공에서는 데이터 구조론이라는 과목으로 방대하게 배운다던데주변 개발자들이 그거 학부때 공부하는 거 아니에요? 라고 일침하길래..제대로 공부하는건 당분간은 미뤄두려고 한다. 본론 고고!! Linked List is a data structurethat consists of a group of nodeswhich represent a sequence together LinkedList 는 기차칸이 총 N 개인 기차이다.각 기차칸 (노드) 는 이렇게 일련의 순서를 가지고 연결되어있다. 1번 기차칸은 ..
-
[30일코딩] 범위 Scope개발입문/JAVA 2017. 5. 7. 10:14
SCOPEIMPORTSPACKAGES 1. Packages 패키지 A group of similar classes- Built-in packages- user-defined packages - import pkg1.pkg2.(...).class1top, second level of package... finally get to the class되도록이면 구체적인 클래스 단위로 import 하기! 2. Scope 범위lifetime and accessibility of a variable- Class Level- Method Level- Public / Private- Looping, Control Statement like Global Variable, Local Variablewhere it decla..
-
[30일코딩] Abstract Class 추상클래스개발입문/JAVA 2017. 5. 7. 09:49
Abstract Class - 즉, 구조 잡는 데에만 사용할 수 있다. - 그리고 하위의 구체적인 클래스는 추상클래스의 메소드를 상속해야한다. - Abstract Class, Abstract Methods- Instance Of- Type Casting Abstract Class - Class with at least one abstract method,추상메소드가 한개라도 있는 클래스이며, - a method declared without implementation추상메소드의 경우 메소드의 시그니쳐만 있고 구현은 없다. - may have abstract and non-abstract (defined) method추상메소드와 구상메소드 모두 가질 수는 있다. - cannot be initialized인..
-
[30일코딩] Inheritance 상속개발입문/JAVA 2017. 5. 7. 00:20
상속 Inheritance Inheritance... 상속은defines the relationship between the superclass and the subclass.부모클래스와 자식클래스 간의 관계 - parent superclass has the traits originally- child subclass inherits the traits- Everything created as a class inherit the Object class. public / private 접근제어자 private int age;다른 클래스에서 접근 불가능합니다. :)대신 getter/setter 메소드로 접근 가능합니다. public int getAge() {return age;} public void set..