import java.awt.*; class Ticker extends Component { public static void main (String [] args) { Ticker t = new Ticker(); /* Missing Statements? */ } }
which two of the following statements, inserted independently, could legally be inserted into missing section of this code? package testpkg.p1; public class ParentUtil { public int x = 420; protected int doStuff() { return x; } } package testpkg.p2; import testpkg.p1.ParentUtil; public class ChildUtil extends ParentUtil { public static void main(String [] args) { new ChildUtil().callStuff(); } void callStuff() { System.out.print("this " + this.doStuff() ); /* Line 18 */ ParentUtil p = new ParentUtil(); System.out.print(" parent " + p.doStuff() ); /* Line 20 */ } }
which statement is true?
/* Missing Statement? */ public class foo { public static void main(String[]args)throws Exception { java.io.PrintWriter out = new java.io.PrintWriter(); new java.io.OutputStreamWriter(System.out,true); out.println("Hello"); } }
What line of code should replace the missing statement to make this program compile?
/* Missing statements? */ public class NewTreeSet extends java.util.TreeSet { public static void main(String [] args) { java.util.TreeSet t = new java.util.TreeSet(); t.clear(); } public void clear() { TreeMap m = new TreeMap(); m.clear(); } }
which two statements, added independently at beginning of the program, allow the code to compile?