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
variables
:
Content language: English
Русский
What will be the result of the following program execution? public class Test { private void method1() { MyClass obj = new MyClass(); obj.x = 1; method2(obj); System.out.println("obj.x="+obj.x); } private void method2(MyClass param) { param.x = 2; param = new MyClass(); param.x = 3; } class MyClass { int x; } public static void main(String[] args) { new Test().method1(); } }
variables
What is the result of the following code compilation? class Quest3 { public static void main(String s[ ]) { String args; System.out.print(args + s); } }
variables
Given the class: public class Clazz { public static void main(String[] args) { // input here } } which of the following definitions can be added to it so that it successfully compiles?
variables
What is the maximum possible length of the variable name according to The Java Language Specification?
variables
What will the following code print? public class A { int a; //--1-- public short getB() { short b; //--2-- return b; //--3-- } public static void main(String[] args) { System.out.print(new A().a); // --4-- System.out.println(new A().getB()); } }
variables
What will be the result of the main method in the Main class execution? public class Main { private int anInt = 4; public Main() { anInt = 5; } public static void main(String[] args) { Main m = new Main(); int anInt = 6; m.print(anInt); } public void print(int anInt){ System.out.println(anInt); } }
variables
What is the result of the following code compilation and execution? public class Main{ final int x = 1; public static void main(String [] str) { int x = 2; //1 for (x = 3 ; x < 5 ; x++); //2 System.out.println("x=" + x); } }
variables
case class Key(x: Int, var y: Int) val key = Key(1,2) val someMap = Map(key -> (1,2)) val newKey = key newKey.y = 3 val newMap = someMap + (newKey -> (1,3)) println(newMap(key)) What will be printed into the console?
variables
MUST NOT use "var" inside a case class
variables
Select all correct ways to define a, b and c with value of 5
variables
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes