IntelliJ Java IDE
The moose likes Mock Exam Errata and the fly likes gEs demo -  question on valid inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Mock Exam Errata
Reply Bookmark "gEs demo -  question on valid inner class" Watch "gEs demo -  question on valid inner class" New topic
Author

gEs demo - question on valid inner class

Linda Xu
Ranch Hand

Joined: Feb 14, 2000
Posts: 51
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
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
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
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
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
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
doesn't "i" need to be final in order for the nested class to reference it?


Sun-Certified Java Programmer
Larry LeFever
Greenhorn

Joined: Jun 13, 2000
Posts: 18
oops.
that's only for locals and args, right?
 
 
subject: gEs demo - question on valid inner class
 
Threads others viewed
Inner Class
please respond to this question on inner classes.
About Inner class!
inner class
Innerclasses
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture