aspose file tools*
The moose likes Jobs Discussion and the fly likes Interview questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Careers » Jobs Discussion
Bookmark "Interview questions" Watch "Interview questions" New topic
Author

Interview questions

HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
6. Which statement is true about a non-static inner class?
a) It must implement an interface
b) It is accessible from any other class
c) It can only be instantiated in the enclosing class
d) It can access private instance variables in the enclosing object
e) It must be final if it is declared in a method scope.

regards
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
the obvious answer is c but i may not be correct. this sounds awfully like an exam question, i hope you're not using a laptop during your exam lol


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Are you kidding ! This is an interview question I got this morning. I could have breezed it about 2 years ago.
The fact that I got the same set of questions from a different agency same client a month ago is neither here nor there. This is the way the client likes to sift through prospective interviewees.

Now don't ask for the whole set of 20 questions.
regards
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

c and d. Please post more questions.


Groovy
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
First.+ why are you sure about d. I might give y'all another one.
regards
Steve Chernyak
Ranch Hand

Joined: Oct 19, 2000
Posts: 113

Prints "Outer" so, d is correct.
Does Tester.InnerTester inner = new Tester().new InnerTester(); mean it was created outside of the enclosing class? That would make c false.
[ November 18, 2003: Message edited by: Steve Chernyak ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
This was my reponse :
> > 6. Which statement is true about a non-static inner class?
> > c) It can only be instantiated in the enclosing class
> > d) It can access private instance variables in the enclosing object
> > e) It must be final if it is declared in a method scope. (Not sure about this answer - it seems a bit ambiguous)
about e)
c is correct IMHO. A single outer class can also have many instances of non-static inner classes if memory serves me right.
SC : Does Tester.InnerTester inner = new Tester().new InnerTester(); mean it was created outside of the enclosing class ?

new Tester(). is the enclosing class and new InnerTester() is created within it;
regards
[ November 18, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
c is correct IMHO. A single outer class can also have many instances of non-static inner classes if memory serves me right.

Any examples come to mind ?
regards
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Since you have been such good sports , you can have another question.
( I didn't sign any non-disclosure agrrements. ) so I'll combine two questions into one .

4. Which of the following describe ways that dynamic information can be
made available to all servlet requests sent to an application and which of the following can be used to store client side user state
information while avoiding any impact due to the users web browser
configuration?
> a) information in a Properties file
> b) information available from a singleton
> c) information in HttpSessions
> d) information in Hidden tags
> e) information in the ServletContext
> f) information in Cookies
> g) information in URL rewriting
> h) information in an HttpSession

regards
[ November 19, 2003: Message edited by: HS Thomas ]
D. Rose
Ranch Hand

Joined: Apr 25, 2003
Posts: 215
I think e and h.
Please keep poeting your questions. It helps.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Rei, there are two questions in there. So two set of answers and reasons would help. This is the last question. The others are rather boring not to mention the fact that I'll start worrying that I have revealed too much.
By this time I imagine the list of questions has circled the agencies who are probably giving out the answers themselves.
I have worked for a car manufacturer before and this is one slip up that shows clueless management and lack of a sense of security. Cutting costs of bringing someone in to interview. haha.
I could have made an effort to answer the questions at length but seeing the same questions second time around has alarm bells ringing in my head.

regards
Steve Chernyak
Ranch Hand

Joined: Oct 19, 2000
Posts: 113
4. b,c,d,g,e,h

new Tester(). is the enclosing class and new InnerTester() is created within it;

I guess im not clear what "in the inclosing" class meant.
A private method can only be called from within the enclosing class right?
Does "from within" and "in the enclosing class" not mean the same thing?
Thanks for the questions.
Trijoy Saikia
Greenhorn

Joined: Nov 20, 2003
Posts: 3
4. Which of the following describe ways that dynamic information can be
made available to all servlet requests sent to an application configuration?
> c) information in HttpSessions
> d) information in Hidden tags
> f) information in Cookies
and which of the following can be used to store client side user state
information while avoiding any impact due to the users web browser
> c) information in HttpSessions
> e) information in the ServletContext
> g) information in URL rewriting
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interview questions
 
Similar Threads
static inner class
Where Can I Read about Non-Static Inner Classes?
Inner and outer class instances
Local Classes
Inner