aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Static member class-Ques from ExamLab Practice test 1 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 "Static member class-Ques from ExamLab Practice test 1" Watch "Static member class-Ques from ExamLab Practice test 1" New topic
Author

Static member class-Ques from ExamLab Practice test 1

promila singh
Greenhorn

Joined: Jan 15, 2007
Posts: 24

This ques I got from ExamLab but I changed this code..My ques is even If there is no class C this still compiles fine..n don't give compiler error or any exception..why this happens paricularly with code??

promila


SCJP 6.0 Preparing for SCWCD
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

The code doesn't look like a mock exam question from any angle to me. There are multiple errors in the code, there is no closing curly brace for class A, the method capture is defined twice in class B, C is undefiined, capture method is not a part of class A so line ab.capture(); is also invalid. There is no way that this code can compile fine...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

If this is the code with which you are working
Then the code might compile fine, this is because earlier you might have compiled the code where there was a class named C, so your folder would contain a C.class file, if you remove that file, the program will fail to compile as it should...
promila singh
Greenhorn

Joined: Jan 15, 2007
Posts: 24
you are right ankit..
there was C.class in my my folder where i also compiled this class...
thnx
one more thing...this code is from ExamLab, you then check it, its the first question in practice test 1....rest I mentioned that I modified it slightly..
promila
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

promila singh wrote:thnx
.....I modified it slightly.

But your modifications made the code uncompilable, that's why I thought its some sort of code that you created yourself. But later on when I indented the code, I saw that you forgot to close class B and A.

And please UseRealWords, and don't use words like thnx...
 
 
subject: Static member class-Ques from ExamLab Practice test 1