File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Explanation needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Explanation needed" Watch "Explanation needed" New topic
Author

Explanation needed

arivu mathi
Ranch Hand

Joined: Jun 26, 2006
Posts: 38
class B {
private String name;
public B(String name) {this.name = name;}
public String toString() {return name;}
protected void finalize() {System.out.print(name);}
}
class J {
static B bc;
static int i = 1;
static B m1(B b) {bc = b; return new B("B" + i++);}
public static void main (String[] args) {
B x = m1(new B("Ba")), y = m1(new B("Bb"));
System.out.println(", " + x + ", " + y + ", " + bc);
}}
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Please use tags to enclose formatted code.

What do want an explanation about? A compile error? An exception at runtime? Unexpected output? Have you even attepted to compile this code? Run it?

In other words: ShowSomeEffort
[ July 19, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Sujittt Tripathyrr
Ranch Hand

Joined: Jun 21, 2006
Posts: 96
what you want from the code please specify clearly.
 
Consider Paul's rocket mass heater.
 
subject: Explanation needed
 
Similar Threads
Garbage collection questin from Danchisolm
Danchisholms: GC question, answer mismatch
Unexpected output is coming..
Que regarding Dan's Exam
Garbage collection