I am the one who was not sure if shift signs were covered and what '&' meant a couple of hours before the exam.
Fortunately, I passed with 63%. Thanks Andres Gonzalez, Marcus
Green, Hanna Habashy, Dhanashree M, and Chi Lin for answering my
questions promptly. Also thanks everyone's input on this forum.
I think I under-estimated the difficulty of the exam. Or at least I
got the questions that happened to be tough.
Within the first 12 questions, almost everyone was related to
Thread, at least 6 of them were appeared in a row. I was even
wondering they gave me the wrong exam that might named "Sun
Certified Thread Programmer". For those of you who have not taken
the exam, I strongly recommend you to practice on this topic more
and understand the "monitor", "synchronized", and "mutually exclusive
lock" concepts.
I also saw lots of code that I'd never seen before. However, it is too late to know that
for(int i =0; i<5; System.out.println(i))
{ i++; }
compiles and runs
One hour before the exam, I was suddenly puzzled by the following
code when I was playing with
polymorphism. I wasn't able to fully understand the results before taking the exam. Luckily, I did not meet such kind of questions. Below are my unsolved question:
/****************File Test.java**************************/
class A
{
public void amethod(A a) { System.out.println("A");}
}
class B extends A
{
public void amethod(B b) { System.out.println("B");}
}
class C extends B
{
public void amethod(C c) { System.out.println("C");}
}
public class
Test {
public static void main(
String args[])
{
A a = new A();
B b = new B();
C c = new C();
A c2 = new C();
c2.amethod(a);
c2.amethod(b);
c2.amethod(c);
}
}
/*****************File Test2.java************************/
class A
{
public void amethod() { System.out.println("A");}
}
class B extends A
{
public void amethod() { System.out.println("B");}
}
class C extends B
{
public void amethod() { System.out.println("C");}
}
public class Test2
{
public static void main(String args[])
{
A a = new A();
B b = new B();
C c = new C();
A c2 = new C();
c2.amethod();
c2.amethod();
c2.amethod();
}
}
If you compile the code, you will see that Test.class outputs AAA while Test2.class outputs CCC. I don't quite get it. Can anyone give me a hand?