Chris Pollett>Old Classes>PIC 20, Winter 2000>Practice Midterm
public class Hello { public static void main(String args[]) { int j = 5; while ( j<5) { j++; System.out.println("hello"); } } }
do { j++; System.out.println("hello"); } while ( j<5);?
MyClass[] isHappy, rightNow; MyClass givesGoodEvaluations[5]; MyClass acesMidterms[]; MyClass *isPayingAttention;
public class CalledHow { public static void main (String args[]) { FooClass a,c,d; int b[] = {1,2,3}; a =new FooClass("hi there"); d = new FooClass("hi"); c=twiddle(a,d,b); System.out.println("a.getFoo()="+a.getFoo()+" b[0]="+b[0]); System.out.println("c.getFoo()="+c.getFoo()+" d.getFoo()"+d.getFoo()); } static FooClass twiddle( FooClass foo, FooClass foo2, int i[]) { foo.setFoo("hello"); foo2=foo; i[0]++; return foo2; } } class FooClass { String s; public FooClass(String string) { s=new String(string); } public String getFoo() { return s; } public void setFoo(String string) { s=new String(string); } }What does each System.out.println(...) print? Explain your reasoning.