programming languages Online Quiz - 32
Description: programming languages Online Quiz - 32 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
What is the output for the below code ? public class A {} public class B implements Serializable { A a = new A(); public static void main(String... args){ B b = new B(); try{ FileOutputStream fs = new FileOutputStream("b.ser"); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(b); os.close(); }catch(Exception e){ e.printStackTrace(); } } }
What is the output for the below code ? public class Outer { private String x = "Outer variable"; void doStuff() { String z = "local variable"; class Inner { public void seeOuter() { System.out.println("Outer x is " + x); System.out.println("Local variable z is " + z); } } } }
What is the output for the below code ? public class Test { public static void main(String... args) { for(int i = 2; i < 4; i++) for(int j = 2; j < 4; j++) assert i!=j : i; } }
Synchronized resizable-array implementation of the List interface is _____________?
What is the output for the below code ? public class Test { public static void main(String argv[]){ ArrayList list = new ArrayList(); ArrayList listStr = list; ArrayList listBuf = list; listStr.add(0, "Hello"); StringBuffer buff = listBuf.get(0); System.out.println(buff.toString()); } }
What is the output for the below code ? import java.util.LinkedList; import java.util.Queue; public class Test { public static void main(String... args) { Queue q = new LinkedList(); q.add("newyork"); q.add("ca"); q.add("texas"); show(q); } public static void show(Queue q) { q.add(new Integer(11)); while (!q.isEmpty ( ) ) System.out.print(q.poll() + " "); } }
What are the new features added to Java 1.5?
Key word "transient" is used so that the state of the object is not saved... (T/F)
Can you call one constructor from another if a class has multiple constructors