Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Lectures / lecture4

.pdf
Скачиваний:
32
Добавлен:
14.10.2016
Размер:
746.02 Кб
Скачать

Static Imports

A static import statement makes the static members of a class available under their simple name.

– Given either of the following lines:

import static java.lang.Math.random; import static java.lang.Math.*;

– Calling the Math.random()method can be written as:

public class StaticImport {

public static void main(String[] args) { double d = random();

}

}

Quiz

The number of instances of a static variable is related to the number of objects that have been created.

a.True

b.False

Соседние файлы в папке Lectures