There are two classes that are declared in the file.
That will be displayed after the launch?

class Singleton {
	private static Singleton s = new Singleton();
	protected Singleton() {
	public static Singleton getInstance() {
		return s;
public class Test {
	public void method() {
	public static void main(String [] str) {
		new Test();

Initialization of static fields is done during the initialization of the class. The initialization of the class in its turn is performed at the first reference to the class (creation of the exemplar of the class, a call to the static field or method, etc.)

More details about the initialization of classes can be found in the Java Language Specification:

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Java
Зареєструйся Зараз
або Підпишись на майбутні тести