Skip to content

Android Interview Question

Namgyu Park edited this page Sep 2, 2020 · 42 revisions
목차
Design Pattern
Thread
Kotlin
Network
Media

Design Pattern






  • Q6) 출력물 끝에 JAVA 라는 signature 을 추가하는 Printer 가 존재한다. 만약 Kotlin 라는 signature 를 지원해달라고 요청이 올 경우, 아래의 코드를 어떻게 변경할 것인가요?

조건 1. 객체지향원칙 중 Open-Closed Principal 개방 폐쇄 원칙 을 위반하지 않아야 합니다.

class Printer {
    fun print(contents: String): String {
        return "$contents\n\nJAVA"
    }
}

companion object fun main(args : IntArray) {
    val printer = Printer()
    printer.print("New documents!")
}

Thread

Kotlin

Network

Media

Clone this wiki locally