This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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??
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...
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...
Joined: Jan 15, 2007
you are right ankit..
there was C.class in my my folder where i also compiled this class...
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 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.