programming languages Online Quiz - 178
Description: programming languages Online Quiz - 178 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Given: class CardBoard { Short story = 5; CardBoard go(CardBoard cb) { cb = null; return cb; } public static void main(String[] args) { CardBoard c1 = new CardBoard(); CardBoard c2 = new CardBoard(); CardBoard c3 = c1.go(c2); c1 = null; // do Stuff } } When // doStuff is reached, how many objects are eligible for GC?
Given: 1. class Dims { 2. public static void main(String[] args) { 3. int[] [] a = {{1,2,}, {3,4}}; 4. int[] b = (int []) a [1] ; 5. Object o1 = a; 6. int[] [] a2 = (int[] []) o1; 7. int[] b2 = (int []) o1; 8. System.out.println(b[1]); 9. } } What is the result?
Given: 1. class Example { 2. public static void main(String[] args) { 3. Short s = 15; 4. Boolean b; 5. // insert code here 6. } 7. } Which, inserted independently at line 5, will compile? (Choose all that apply.)
Given: class Knowing { static final long tooth = 343L; static long doIt(long tooth) { System.out.print(++tooth + " "); return ++tooth; } public static void main(String[] args) { System.out.print(tooth + " "); final long tooth = 340L; new Knowing().doIt(tooth); System.out.println(tooth); } } What is the result?
Given: public class MyOuter { public static class MyInner { public static void foot) { } } } Which, if placed in a class other than MyOuter or MyInner, instantiates an instance of the nested class?