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
compilation
:
Content language: English
Русский
What will be printed out as a result of the following code execution / compilation? public class Test { static void m(int ... a) { System.out.println("1"); } static void m(Integer ... a) { System.out.println("2"); } public static void main(String[] args) { m(1, 2); } }
compilation
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); } }
compilation
What will be the result of the compilation and execution of the following code: interface I { public final static int EASY = 5; } public class Main implements I { public static void main(String[] args) { int a = 5; test(++a); } static void test(int a) { a += EASY + a++; System.out.println(a); } }
compilation
What will happen when you try to compile and run the following code? It is assumed that the outstream file is already created. import java.io.*; public class Main { public static void main(String[] args) { try { FileInputStream fis = new FileInputStream("outstream"); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); try { do { String str = br.readLine(); System.out.println(str); } while (str != null); } finally { fis.close(); isr.close(); br.close(); } } catch(IOException e){ e.printStackTrace(); } } }
compilation
What lines will the compilation error occur in: class MyException1 extends Exception { } // 1 class MyException2 extends RuntimeException { } // 2 class A { void m1() { throw new MyException1(); } // 3 void m2() { throw new MyException2(); } // 4 }
compilation
What can be said about the following program? public class String { static String[][]String = {{"String"}}; // 1 static { System.out.println(String.class); // 2 } public static void main(String[] args) { // 3 System.out.println(String.class); // 4 } }
compilation
Which of the following lines will compile without errors?
compilation
What is the result of the following code compilation and execution: class Quizful { private Double x = 2; public static void multX(Quizful q, Double n) { q.setX(q.getX() * n); } public Double getX() { return x; } public void setX(Double x) { this.x = x; } public static void tripleValue(Double x) { x *= 3; } public static Quizful resetX(Quizful q) { q = new Quizful(); return q; } public static void main(String[] args) { Double x = 4; tripleValue(x); Quizful q = new Quizful(); multX(q,x); resetX(q); System.out.print(q.getX()); } }
compilation
Which of the following pieces of code are considered to be a correct Java code?
compilation
What will be the result of the following code execution? public class Test { public static void main(String args[]) { byte a = 1; byte b = ++a; byte c = -a; System.out.print(a); System.out.print(b); System.out.print(c); } }
compilation
← Prev
1
2
3
4
5
Next →
Sign Up Now
or
Subscribe for future quizzes