본문
170614(수) - Kotlin docs (Packages)
Mobile/Kotlin 2017. 6. 14. 15:20
Kotlin docs
Packages
Packages
package foo.bar
fun baz() {}
class Goo {}
// ...
Default Imports
- every kotlin file
- kotlin.*
- kotlin.annotation.*
- kotlin.collections.*
- kotlin.comparisons.* (since 1.1)
- kotlin.io.*
- kotlin.ranges.*
- kotlin.sequences.*
- kotlin.text.*
- Additional packages are depending on target platform.
- JVM
java.lang.*
kotlin.jvm.*
- JS
kotlin.js.*
Imports
import foo.Bar // Bar is now accessible without qualification
import foo.* // everything in 'foo' accessible
import foo.Bar
import bar.Bar as bBar // bBar stand for 'bar.Bar'
- import는 importing class 말고도 여러가지 선언 가능
- top-level functions and properties
- functions and properties declared in object declarations
- enum constants
- Java의 import static은 사용 불가능
Visibility of Top-level Declarations
top-level declaration이 private이면 선언된 파일도private이다.
'Mobile > Kotlin' 카테고리의 다른 글
170621(수) - Kotlin docs (Return and Jumps) (0) | 2017.06.21 |
---|---|
170619(월) - Kotlin docs (Control Flow) (0) | 2017.06.19 |
170607(수) - Kotlin docs (Basic Types) (0) | 2017.05.31 |
170530(화) - Kotlin docs(Coding Conventions) (0) | 2017.05.30 |
170529(월) - Kotlin docs (Idioms) (0) | 2017.05.29 |
댓글