I got this question in ge is mock exam: Given the following class definition: Class A { protected int i ; A( int i) { this.i = i; } } which of the following will be a valid inner class for this class? ... C. class B { B() {System.out.println("i=" +i);} } The answer said the above is not a correct answer. But I tried to compile, it compile and run without any exception? What's wrong? ge give the wrong answer?
maha anna
Ranch Hand
Joined: Jan 31, 2000
Posts: 1467
posted
0
Linda, For the given class, the given inner class is valid. What I think is there may be someother information you would have forgotten to post. I am not sure. Can you post the exact qstn from the Exam? The given code will produce two .class files in the current dir where it is compiled if no other redirection option is given while compiling. They are 1. A.class 2. A$B.class regds maha anna
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
posted
0
It looks like the exam question is wrong. What is the URL for this "ge is mock exam"? And does this question have a number?
"I'm not back." - Bill Harding, Twister
Linda Xu
Ranch Hand
Joined: Feb 14, 2000
Posts: 51
posted
0
Sorry, there is a typo about the exam name. It's the gE's mock exam. I downloaded the evaluation edition. There is 15 questions in it. About this question, the question body is like my first post. There is fives items for multi select, because I understand other four, I omit them. The C item is exactly as I posted. So, the C should be right answer here?
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
posted
0
Yup. I'll move this to Mock Exam Errata so others can find it in the future. Thanks.
Javix Protocol
Ranch Hand
Joined: Mar 21, 2000
Posts: 57
posted
0
I also attende that exam and i suppose that what xu i s telling is correct. Can maha anna caretake this affair properly?
Write Once , Run Anytime ,Anywhere Forever And Smile Happily.
Larry LeFever
Greenhorn
Joined: Jun 13, 2000
Posts: 18
posted
0
doesn't "i" need to be final in order for the nested class to reference it?