Lecture04 - 1 Consider the following source code public class Foo cfw public static void main(String args int x Object ob = new String\"ab String s =\"ab

Lecture04 - 1 Consider the following source code public...

This preview shows page 1 - 9 out of 31 pages.

1
Image of page 1
2 Consider the following source code: public class Foo { public static void main(String [] args) { int x; Object ob = new String("ab"); String s = "ab"; long w = s.length(); x = ob.length(); x = ((String)ob).length()+2; x = foo(ob, x, x); x = foo(s, x, w); x = foo(s, x, x); System.out.println(x); } public static int foo(Object o, long i, int j){ return 5; } public static int foo(String s, int i, long j){ return 6; } }
Image of page 2