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 execution / compilation? class A { public A() { System.out.print("A"); } } class B { public B() { System.out.print("B"); } } class C { public C() { System.out.print("C"); } } public class D extends C { private A objA = new A(); private static B objB = new B(); public D() { System.out.print("D"); } public static void main(String[] args){ new D(); } }
static keyword
What will the following code.s execution print to console? public class Test { static int b = Test.a; static final int a = 3; public static void main(String... args) { System.out.println("a = " + a + ", b = " + b); } }
static keyword
Can the main method be declared as final?
static keyword
What will be the result of the following code compilation and execution? class Quizful { private int xp = 0; static void add(Quizful q, int value) { q.xp = q.xp + value; } static void multiply(int xp, int value) { xp = xp * value; } public static void main(String[] args) { Quizful q = new Quizful(); add(q, 2); multiply(xp, 3); System.out.print(q.xp); } }
static keyword
What is the result of the following code execution? abstract class Test{ private static int getHalf(int i){ return i/2; } public static void main(String[] str){ int half=getHalf(0); System.out.println("Result is:"+half); } }
static keyword
What will the following code display? class Quizful { private static int count = 0; private final int id = ++count; private void print() { System.out.println(id); } public void printOther(Quizful other) { other.print(); } public static void main(String[] args) { Quizful one = new Quizful(); Quizful two = new Quizful(); two.printOther(one); } }
static keyword
Will the following code compile? public class StartClass { private final String DUMMY = "DUMMY"; public static void main(String[] args) { System.out.println(DUMMY); } }
static keyword
Which line will the first compilation error occur in? public class Test { /* 1 */ public final static class A {} /* 2 */ static private class B {} /* 3 */ abstract static class C {} /* 4 */ static final private class D {} /* 5 */ final public abstract class E {} /* 6 */ static final abstract class F {} }
static keyword
What is the result of the following code execution? public class Test { static { i = 5; } static int i = 6; public static void main(String[] args) { System.out.println(i); } }
static keyword
What will be displayed after the following code execution? public class Tasks { public static Tasks instance = new Tasks(); private static final int DELTA = 5; private static int BASE = 7; private int x; public Tasks() { x = BASE + DELTA; } public static void main(String[] args) { System.out.println(Tasks.instance.x); } }
static keyword
← Prev
1
2
3
4
5
Next →
Sign Up Now
or
Subscribe for future quizzes