Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explanation needed

 
arivu mathi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Sujittt Tripathyrr
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what you want from the code please specify clearly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic