Imports

Oftenly you need to import content defined out of the current class. These contents can be classes, objects, interfaces and functions.

Importing A Single Name

import com.tutorialsloop.myproject.Spacecraft

This then makes Spacecraft accessible without further qualification.

Wildcard Imports

We can also Import All Accessible Scope Contents.
These contents can be other packages, classes, objects etc.

import com.tutorialsloop.myproject.*

We can reslove name clashes using the as keyword to locally rename the clashing entity.

import com.tutorialsloop.hisproject.Spacecraft
import com.tutorialsloop.myproject.Spacecraft as MySpacecraft

In the above example, Spacecraft and MySpacecraft can then be used:

fun doubleFoo() {
    val s1 = Spacecraft()
    val s2 = MySpacecraft()
}