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
final keyword
:
Content language: English
Русский
What will be printed out as a result of the following code execution / compilation? public class Test { private String name; Test(String name) { this.name = name; } public void test(final Test test) { test = new Test("three"); } public String toString() { return name; } public static void main(String[] args) { Test t1 = new Test("one"); Test t2 = new Test("two"); t1.test(t2); System.out.println(t2); } }
final keyword
What will be the result of the following code compilation and execution? public class Test { final String s; public Test() { s = "default"; } public Test(String s) { } public static void main(String[] args) { System.out.println(new Test().s); } }
final keyword
Is it possible to use abstract and final modifiers during a class declaration at the same time?
final 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); } }
final keyword
Can the main method be declared as final?
final 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 {} }
final 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); } }
final keyword
Is it possible to inherit from the class java.lang.String?
final keyword
Which of the following statements are true?
final keyword
What is the result of the following code compilation and execution? public class Test { public static void main(String[] args) { for (final int i : new int[] { 1, 2, 3 }) { System.out.println(i + 1); } } }
final keyword
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes