Win a copy of Spring Boot in Practice this week in the Spring forum!

saikrishna

Greenhorn
+ Follow
since Jul 16, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by saikrishna

Hai all!
I passed SCJP with 85% today. I found that K&B is the most suitable book and Dan and Marcus's mocks tests are very help for this test.
I got the questions as follows:
Threads : 6 to 8
GC : 3 to 4
Encapsulation : 2
Collections : 3
Assertions : 2
Overriding and overloading : 7 to 8
String, StringBuffer : 4 to 6
Math : 4 to 6
and so on.
Mock tests in various sites and especially javaranch site really helped me a lot in my preparation.
I would like to thank all the members of this big forum.
Saikrishna
[ June 19, 2003: Message edited by: saikrishna ]
19 years ago
What happens when you attempt to compile and run these two files in the same directory?
//File P1.java
package MyPackage;
class P1{void afancymethod(){ System.out.println("What a fancy method");
}
}
//File P2.java
public class P2 extends P1{
public static void main(String argv[]){P2 p2 = new P2();
p2.afancymethod();
}}
1) Both compile and P2 outputs "What a fancy
method" when run
2) Neither will compile
3) Both compile but P2 has an error at run time
4) P1 compiles cleanly but P2 has an error at
compile time
Answer given as 4.
Please let me know in detail why the remaining options are incorrect.
Thank you in advance.
:roll: