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
primitive types
:
Content language: English
Русский
Which line/lines will compilation error occur in? public class Test { public static void main(String[] args) { char c = (char) 1; // 1 boolean boo = (boolean) 1; // 2 byte b = (byte) true; // 3 } }
primitive types
What is the result of the following program execution? public class Test { public static void main(String[] args) { char ch = '0'; for (; ch <= 9; ch++) System.out.print(ch); } }
primitive types
What is the result of the following program execution? public class A { public static void main(String[] args) { Boolean b1 = true; Boolean b2 = new Boolean("/false"); String s1 = "" + 1 + '+' + 1 + '=' + (1 + 1) + " is "; String s2 = s1 + b1 + '/' + b2; System.out.println(s2); } }
primitive types
Will the following code compile? public class GenericTest { public static void main(String[] args) { List<double> myList = new ArrayList<double>(); } }
primitive types
What will the following code's execution print out? public class Quizful { public static void main(String[] args) { Integer one = 1000; Integer two = 2000; System.out.print((one * 2 == two) ? "yes " : "no "); System.out.print((two / 2 == one) ? "yes " : "no "); } }
primitive types
What is the result of the following code compilation and execution? public class MainClass { public static void test(int ...a) { System.out.println("int..."); } public static void test(Integer ...a) { System.out.println("Integer..."); } public static void test(Number ...a) { System.out.println("Number..."); } public static void main(String args[]){ Number n = new Integer(1); test(n.intValue()); } }
primitive types
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()); } }
primitive types
What is the result of the following code execution: public class MainClass { public static void main(String args[]){ System.out.println((-(byte)128)>>>1 == 128 >>> 1); } }
primitive types
What will be printed as a result of compiling and running the following code? public class Test { private static Boolean b1, b2; public static void main (String[] args) { if (b1 || !b2 || !b1 || b2) { System.out.println(true); } else { System.out.println(false); } } }
primitive types
What happens when you compile and run the following code? public class Test { static int[] arrInstance = new int[100]; public static void main(String[] args) { byte[] arrLocal = new byte[100]; for (int i = 0; i < 100; i++) if (arrInstance[i] != arrLocal[i]) { throw new IllegalStateException("error"); } } }
primitive types
← Prev
1
2
3
4
Next →
Sign Up Now
or
Subscribe for future quizzes