Description: programming languages Online Quiz - 52 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Given: 11.classA { 12. public void process() { System.out.print(”A “); } } 13. class B extends A { 14. public void process() throws RuntimeException { 15. super.process(); 16. if (true) throw new RuntimeException(); 17. System.out.print(“B”); }} 18. public static void main(String[] args) { 19. try { ((A)new B()).process(); } 20. catch (Exception e) { System.out.print(”Exception “); } 21. } What is the result?
You read the following statement in a Java program that compiles and executes. submarine.dive(depth); What can you say for sure?
class Eggs { int doX(Long x, Long y) { return 1; } int doX(long... x) { return 2; } int doX(Integer x, Integer y) { return 3; } int doX(Number n, Number m) { return 4; } public static void main(String[] args) { new Eggs().go(); } void go() { short s = 7; System.out.print(doX(s,s) + " "); System.out.println(doX(7,7)); } } What is the result?
public class A { private int counter=0; public static int getInstanceCount() { return counter; } public A() { counter++; } } Given this code from Class B: 25. A a1 = new A(); 26. A a2 = new A(); 27. A a3 = new A(); 28. System.out.println(A.getInstanceCount()); What is the result?
Which are valid declarations? (Choose all that apply)
Casting occurs commonly between numeric types
Which of the following are methods of the Thread class.
Select three correct statements.
How old are you 7
How old are you 6
How old are you 5
How old are you 4
How old are you 3
How old are you 2
How old are you 1
How old are you
Select three correct statements