Java
What will ...
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
What will be written as a result of executing the following code fragment:
System.out.println(01232d);
1232
01232d
1232.0
666 (octal 1232)
4658 (hex 1232)
compilation error
Explanation
character
d
in the end emphasizes that the number is real (double), so the zero character at the beginning doesn't matter
numbers
1
(1)
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Mark the answer choices in which the pairs are equal to each other (2 correct answers):
What will be printed out as a result of the following code execution? public class MathTest { public static void main(String... args) { System.out.println((-7 % 5) > (7 % -5)); System.out.println(Math.abs(Math.ceil(-2.5)) < Math.ceil(Math.abs(-2.5))); } }
What is the following program output: class Main { public static void main(String[] args) { switch (new Integer(4)) { case 4: System.out.println("4"); break; default: System.out.println("default"); } } }
What will be displayed, if the following code is compiled and executed: public class Main { public static void main(String args[]) { System.out.println("2 + 2 = " + 2 + 2); } }
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()); } }
What will be the result of the following program execution? public class Test { public static void main(String[] args) { Integer i1 = 1000; Integer i2 = 1000; System.out.println(i1 == i2); System.out.println(i1 == 1000); } }
J
ava
Quiz
Login to learn Java
or
Read more about
Java Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
Java quizzes
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(); } }
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); } }
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); } }
What will be printed out as a result of the following code execution / compilation? public class Test { public static void main(String[] args) { ElectricInverter inverter = new ElectricInverter(); int AC = 220; System.out.println(inverter.invert(AC)); } } class ElectricInverter { public static final int AC = ~220; public static final int DC = -110; public static final int GROUND = 0; int invert(int type) { if (type == AC) { return DC; } else if (type == DC) { return AC; } return GROUND; } }
int i = Integer.MAX_VALUE + 10; What is the result of the given line execution?
What happens after the following code is compiled and run: 01: interface TheInterface { 02: void print(); 03: } 04: 05: class TheClass implements TheInterface { 06: public void print() { 07: System.out.println("TheClass"); 08: } 09: } 10: 11: public class ClassConversion { 12: public static void main(String[] args) { 13: TheClass c = new TheClass(); 14: TheInterface i = c; 15: i.print(); 16: } 17: }
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment