Shortcut Navigation:

Main String Arg Quiz

Given: class Q { public static void main(String[] args) { int i1 = 5; int i2 = 6; String s1 = "7"; System.out.println(i1 + i2 + s1); } } What is output?

Given: class Q { public static void main(String[] args) { int i1 = 5; int i2 = 6; String s1 = "7"; // insert code here } } Which of the following lines of code, independantly inserted at “// insert code here”, will produce the same output? (Choose 2)

Given public class Myfile { public static void main (String[] args) { 03 String biz = args[1]; String baz = args[2]; String rip = args[3]; System.out.println("Arg is “ + rip); } } Select how you would start the program to cause it to print: Arg is 2

Given int i = (int) Math.random(); Select the correct answer:

Given String str = “3.14235”; Select two correct ways to declare a float value:

Given class B { public A a; } 04 class A { public B b; } 08 class Test { public static void main (String[] args) { Test t = new Test(); t.makeStuff(); } public void makeStuff() { A a = new A(); B b = new B(); a.b = b; b.a = a; } } When are objects A and B ready for garbage collection?

Which of the following statements are true of Anonymous classes:

If the following code block was within an appropriate try/catch block, would it compile without error? FileInputStream fis = new FileInputStream("inputfile"); ObjectInputStream ois = new ObjectInputStream(fis); Point p = ois.readObject();

Which method(s) must a serializable class implement?

What is the most complete set of exceptions that can be thrown when reading a serialized object?