Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
Singleton
:
Content language: English
Русский
There are two classes that are declared in the file. That will be displayed after the launch? Test.java: class Singleton { private static Singleton s = new Singleton(); protected Singleton() { System.out.println("S"); } public static Singleton getInstance() { return s; } } public class Test { public void method() { Singleton.getInstance(); } public static void main(String [] str) { new Test(); } }
Singleton
Which statements about the following code are correct ? (in some application): public class Singleton { private static Singleton singleton; public static Singleton getInstance() { if (singleton == null) { singleton = new Singleton(); } return singleton; } }
Singleton
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes