Bookmark Topic Watch Topic
  • New Topic

Why?

 
Hassan Naqvi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi friends,
Why the folloeing programme is giving output 0 0
class Bna {
int i;
void f(int i) {
i=i;
}
}

public class Banana {
public static void main(String[] args) {
Bna a = new Bna(), b = new Bna();
a.f(1);
b.f(2);
System.out.println(a.i+" "+b.i );
}
}
Regards,
Hassan.
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Report post to moderator
See duplicate post in Certification Study.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
    Bookmark Topic Watch Topic
  • New Topic