Тесты
Язык сайта: Русский
Українська
English
Русский
Тесты по программированию
Вход
Регистрация
Тесты по программированию
Теория
сниппеты
Статьи
Главная
Android
Цены
FAQ
История Cosmo
Правила и условия сервиса
Политика конфиденциальности
Политика в отношении файлов cookie
Обратная Связь
final keyword
:
Язык контента: English
Русский
What will the following code print: public class Funcs extends java.lang.Math { public int add(int x, int y) { return x + y; } public int sub(int x, int y) { return x - y; } public static void main(String[] a) { Funcs f = new Funcs(); System.out.println("" + f.add(1, 2)); } }
final keyword
Will the following code compile? public class Person { public final String name; int age; }
final keyword
What will be the result of the following program compilation and execution? public class Test { private static class Test2 { private static final String name = "Name"; } public static void main(String[] args) { System.out.println(Test2.name); } }
final keyword
What will be the result when the following code is compiled and executed? final public class Parent { final public void test() { System.out.println("hello"); } } class Child extends Parent { //1 public void test() { //2 System.out.println("world"); } } class Main { public static void main(String args[]) { Child c = new Child(); c.test(); } }
final keyword
How can a class inheritance be prohibited (top-level classes are considered)?
final keyword
What is the result of the following program execution? public class Main { public static void main(String[] args) { final Integer i = 1; switch (1) { case i: System.out.println("1"); break; default: System.out.println("default"); } } }
final keyword
What will be the result of compiling and running the following code: public final class QTest { public static void main(String[] args) { new QTest() { public void show() { System.out.print("2"); } }.show(); } public void show() { System.out.print("1"); } }
final keyword
What will be the result of compilation and execution of the following code? public class TestClass { public static void main(String[] args) { String s = new String(){ public String toString(){ return "new method"; } } System.out.println(s); } }
final keyword
← Предыдущая
1
2
Следующая →
Зарегистрируйся сейчас
или
Подпишись на будущие тесты