File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes anonumous class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Mock Exam Errata
Reply Bookmark "anonumous class " Watch "anonumous class " New topic
Author

anonumous class

sunilkumar ssuparasmul
Ranch Hand

Joined: Dec 13, 2000
Posts: 142
public class Base {
private void aMethod() {
System.out.println("I am in base ");
}
public Base() {}
public static void main(String args[]){
//case 1
Base b = new Base(){
void aMethod(){
System.out.println("inside main of base b");
}
};
b.aMethod();

// case 2
new Base(){
void aMethod(){
System.out.println("inside anonumous of base ");
}
}.aMethod();
}
}
In the above code since i ahve declared aMethod in base as private , the base object b when calls aMethod it prints that I am in base where as when i tried to do the same in the next case i.e case 2 , i am getting "inside anonumous of base " .
CAN SOMEBODY PLZ HELP ME
------------------
"Winners don't do different things
They do things differently"

"Winners don't do different things<br /> They do things differently"
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
I am moving this to Certification Study since it is not related to a specfic Mock Exam error.
Bill
 
 
subject: anonumous class
 
Threads others viewed
Why anonumous inner class is not take the ";"
anonumous arrays?
Inheritance/Polymorphism question
anonumous class
few questions
developer file tools