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
static keyword
:
Content language: English
Русский
What will be printed out as a result of the following code compilation and execution? public class A { { System.out.println("one"); } public static void main(String[] args) { System.out.println("two"); } static { System.out.println("three"); } }
static keyword
What is the result of the following program execution? import static java.lang.Math.*; public class StartClass { public static void main(String[] args) { System.out.println(max(1, 2)); } }
static keyword
What will the compilation result be? package com.one; import static com.two.Two.*; public class One { int x1 = Two.tiger; //1 int x2 = tiger; //2 int x3 = com.two.Two.tiger; //3 int x4 = two.Two.tiger; //4 } Second file: package com.two; public class Two { public static int tiger = 1414; }
static keyword
How should the line 6 of the following code be modified so that the compilation error does not occur (select all that apply)? 1: class Class1 2: { 3: int total = 0; 4: public static void main( String[] args ) 5: { 6: doIt(); 7: } 8: void doIt() 9: { 10: for ( int i = 0; i < 5; i++ ) total += i; 11: System.out.println( total ); 12: } 13: }
static keyword
What is the result of the following code execution? public class Main { static class X { static String x = Y.y; } static class Y { static String y = X.x; } public static void main(String[] args) { Y.y = "0"; System.out.println(X.x); } }
static keyword
Which of the following statements are true?
static keyword
What is the following program`s execution result? class Tack { static short s = 17; public Tack(short ss) { new Tack(); s *= ss; } public Tack() { ; } } public class Bridle extends Tack { public Bridle(int s) { System.out.println(s + 1); } public static void main(String[] args) { Bridle b = new Bridle(3); } }
static keyword
What will print the following code? public class Quizful { static { System.out.println("Bo-Bo!"); } public static void main(String[] args) { System.out.println("Hello, World!"); } static { System.out.println("Go-Go!"); System.exit(0); } }
static keyword
What will be the result of the work of the following program? class A { public A() { System.out.print("A "); } } class B { public B() { System.out.print("B "); } } public class Test { private A objA = new A(); private static B objB = new B(); public Test() { System.out.print("Test "); } public static void main(String[] args){ System.out.print("Main "); new Test(); } }
static keyword
What will be displayed by the following program? public class Main { { System.out.print("1 "); } Main(){ System.out.print("2 "); } public static void main(String[] args) { System.out.print("3 "); Main m = new Main(); System.out.print("4 "); } static { System.out.print("5 "); } }
static keyword
← Prev
1
2
3
4
5
Next →
Sign Up Now
or
Subscribe for future quizzes