JVM

· JVM/Kotlin
Companion Object 클래스 안에 존재하는 SingleTon Object Comapnion이라는 이름을 가진 static Singletone companion keyword는 그냥 Companion이란 이름을 갖는 클래스 객체를 가리키는 shortcut 역할을 할 뿐. companion object 내에 생성된 변수, 메소드는 부모 클래스의 static 맴버가된다. class - companion object는 1:1 매칭 (오로지 1개씩 선언 가능) class ToBeCalled { companion object Test { val someInteger: Int = 10 fun callMe() = println("You are calling me :)") } } fun main(args: Ar..
· JVM/Kotlin
[Elvis Operator] val number : Int = number1 ?: 10 number1이 null -> 10 대입 not null -> number1 대입 [!!] Not Null 임을 개발자가 보장하는것. 협업시 다른사람이 임의로 !!처리한 변수를 null 값을 삽입할 시... 에러가 발생하기 쉽다 애초에 어떤 식에 '!!'키워드를 붙일 수 있다는 것 자체가 nullable Varaible 인 경우일 때 의도치 않게 null값을 갖는 경우 nullPointerException 발생 위험이 생기기 때문에 연산자를 남발하는 것은 좋지 못하다. [lateinit] Non-null Property 가 값이 저장되지 않은 상태를 컴파일러가 '인정'하도록 하는 키워드. 키워드 단어 뜻 그대로 늦은..
· JVM/Java
Java Stream 이란 입/출력 데이터 흐름의 통로 입력 스트림은 소스 데이터로부터 데이터를 읽어들이고 출력 스트림은 목적 대상까지 데이터를 흘려보내 쓴다. Java Stream 특징 Queue , FIFO(First In First Out) 방식 Byte 단위로 흐른다. 입출력 대상에 따라 나뉜다. FileStream -> 파일 ByteArrayStream -> 메모리 (byte 배열) PipeStream -> 프로세스 Input/OutputStream InputStream 은 read() , OutputStream 은 write() 추상 메소드를 기본적으로 구현하게 되어있다. FileInput/Ouput Stream은 모두 In/Output Stream의 자식 abstract method read..
· JVM/Kotlin
Abstract class 와 Interface 는 왜 필요한가? 프로그래밍에서 추상화라는 단어를 듣는다. "무엇을 할것인지"는 노출하고 "어떻게 동작하는지"는 숨기는 것이다. Abstract class와 Interface 는 추상화를 돕는 녀석들이다. 추상화가 필요할 때, 둘중 어느 것을 사용해야할지 차이점을 중심으로 정리해보자. Abstract Class 목적 abstract method, field 를 가질 수 있고 구현부도 가질 수 있다. 특징 변수의 경우 초기화 되지 않는다. 메소드의 경우도 {} body 부분을 갖지 않는다. abstract class간에도 상속 가능하다. Interface 상속받을 서브 클래스에게 구현할 메소드와 변수의 원형(signature)을 알려주어 클래스별 공통 분모만..
· JVM
자주 헷갈릴 수 있는 개념이라 표로 정리해둔다. Element Overriding Overloading Declaration Sub Class equivalent Class Relationship Parent - Child Class (Inheritance) equivalent Goal same method name but specially optimized at sub class same method name and Polymorphism(ex. different parameter type -> different return type) Condition Same Parameter type, the number of parameter Different Parameter (number, type..) Bi..
· JVM/Error
자바 프로젝트에 저렇게 빨간색 느낌표 뜰 때 Build Path에 문제가 있는 것입니다. [Build 시 사용되는 jar 파일의 경로가 바뀐경우] 해결방법 ? 해당 프로젝트 우클릭 - Properties - Java Build Path
M_Falcon
'JVM' 카테고리의 글 목록 (7 Page)