목록All Contents (172)
Code&Data Insights

자바에서 집합을 사용하기 위한 방법에는 대표적으로 HashSet과 ArrayList를 사용하는 것이 있다. 1. HashSet - 자바에서 Hashset 클래스는 저장을 위한 해시 테이블을 생성하기 위해 사용된다 ( Java HashSet class is used to create a collection that uses a hash table for storage.) - 추상클래스인 AbstractSet class를 상속하고 Set interface를 implements 한다. - HashSet은 Set의 파생클래스로, Set은 중복된 원소를 허용하지 않는 집합이다. * HashSet은 순서,중복을 고려하지 X (1) 집합 사용하기 - HashSet // import java.u..

- Form of a recursive algorithms * Recursive Methods - A method that calls itself is known as a recursive method - Every recursive method must contain one or more : Base Cases, each solving the problem directly : Recursive Cases, each reducing the problem at hand to simpler problems of the same type - A recursive call must : must progress towards the base case : be conditional; otherwise, it lea..

[ Inner Class ] : Inner classes are classes defined within other classes - The class that includes the inner class is called the outer class - There is no particular location where the definition of the inner class (or classes) must be placed within the outer class - Placing it first or last, however, will guarantee that it is easy to find An inner class definition is a member of the outer class..

[ Interface ] : 보안을 위해 interface를 사용한다. ( 특정한 디테일을 숨기고, object의 중요한 디테일만을 보여준다 ) - 인터페이스는 인터페이스로만 상속받을 수 있으며, 클래스와 달리 다중상속을 받는 것이 가능하다 - 추상( abstract) 클래스와 같이 인터페이스는 objects를 생성하는데 쓰일 수 없다. - interface 메소드는 body가 존재하지 X, body는 implement class에서 작성되어진다. - On implementation of an interface, you must override all of its methods - Interface methods are by default, abstract and public - Interface att..

[ Thread ] - 한 프로세스 내에서 멀티 태스킹을 할 수 있도록 만들어진 프로세스를 스레드(Thread)라고 하며, 멀티 태스킹이 가능한 이유는 Multi Thread 때문이다. - A thread of execution in a program ( kind of like a virtual CPU ) - The JVM allows an application to have multiple threads running concurrently - Each thread can execute parts of your code in parallel with the main thread * Each thread has a priority ( 모든 쓰레드에는 각각 우선순위가 있다 ) -> Threads with ..
[ Generic ] : 클래스 내부에서 지정하는 것이 아닌 외부에서 사용자에 의해 지정되는 것. : 컬렉션 프레임 워크에서 많이 사용되어짐 - Generics add that type of safety feature. - Generics are used in HashSet / ArrayList / HashMap - The syntax of generic * To create an instance of generic class * BaseType obj = new BaseType () * We cannot use primitive data types like int, char - Type Parameters in Java Generics -> T : Type -> E : Element -> K : Key..
* Java.lang .objects method : equals / toString() / clone() * Object class - 모든 클래스의 최상위 클래스 - java.lang.Object - 모든 클래스는 object 클래스의 method를 사용할 수 있음 *Hashcode - return : jvm(java virtual machine)이 저장한 인스턴스의 주소값을 10진수로 나타냄 - 서로다른 메모리의 두 인스턴스가 같다면? : equals() - true : 동일한 hashcode() return 값을 가져야함.

Instance - 인스턴스는 객체에 포함 - OOP(object oriented programming)의 관점에서 객체가 메모리에 할당되어 실제 사용될 때 '인스턴스'라고 부름 Static Variables ( static 변수 ) - static 변수는 인스턴스가 생성될 때 마다 다른 메모리를 가지는 것이 아니라 프로그램이 메모리에 적재(load)될 때 데이터 영역의 메모리에 생성됨 - 따라서, 인스턴스의 생성과 관계없이 클래스 이름으로 직접 참조 함 - static 변수 = 클래스 변수 ( 인스턴스 변수 = 멤버변수 ) [ArrayList vs Array ] * Array - Fixed Length를 먼저 선언함 -> size 변경 불가 - 연속된 자료구조 ( 인덱스 값이 비어있으면 X ) - ge..