This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Jobs Discussion and the fly likes Interview questions for Java developer, Struts, EJBs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Careers » Jobs Discussion
Bookmark "Interview questions for Java developer, Struts, EJBs" Watch "Interview questions for Java developer, Struts, EJBs" New topic
Author

Interview questions for Java developer, Struts, EJBs

Gina vernon
Ranch Hand

Joined: Jan 16, 2009
Posts: 108
Here are a few questions I was asked at a recent interview. Hope somebody finds this helpful in preparing for an interview.

1. What is the difference between, FINAL, finally{} and finalize()?
2. What are weak and strong references?
3. What can an interface do that a 100% abstract class cannot?
3. Why use stateful beans for persistance instead of stateless beans?
4. How are singletons created in a cluster environment?
5. How are JSPs included within JSPs?
6. What does the ReflectionsAPI do?
7. What design patterns have you used?How?
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

thanks Gina for posting these questions. I didn't know about the weak references. Now got it.

Keep up the good work.

Avi Sinha


SCJP 5.0 SCWCD 5.0
Jeevan Reddy
Ranch Hand

Joined: Nov 10, 2009
Posts: 142
Thanks for posting them. It should be useful to us


SCJP 1.6 (94%)
http://faq.javaranch.com/java/JspFaq
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

These are great. It was good to review Strong References vs Weak References. I'll bet ignorance of these cause a lot of performance problems.
Gina vernon
Ranch Hand

Joined: Jan 16, 2009
Posts: 108
Does anyone have an answer to the following question? I searched the internet but couldn't find anything that specifically addressed this question.

What can an interface do that a 100% abstract class cannot?


Basically, the question was if a developer can get all the functionality of an interface in a 100% abstract class, why even use an interface?

Thanks.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Gina vernon wrote:Does anyone have an answer to the following question? I searched the internet but couldn't find anything that specifically addressed this question.

What can an interface do that a 100% abstract class cannot?


Basically, the question was if a developer can get all the functionality of an interface in a 100% abstract class, why even use an interface?

Thanks.


I think they were looking for:
a class can only extend one abstract class while it can implement any number of interfaces.
Gina vernon
Ranch Hand

Joined: Jan 16, 2009
Posts: 108
Tim McGuire wrote:
I think they were looking for:
a class can only extend one abstract class while it can implement any number of interfaces.


Yup, mentioned that. But the interviewer wasn't satisfied with the answer.
Rohan kanade
Ranch Hand

Joined: Oct 22, 2009
Posts: 106
Gina vernon wrote:Does anyone have an answer to the following question? I searched the internet but couldn't find anything that specifically addressed this question.

What can an interface do that a 100% abstract class cannot?


Basically, the question was if a developer can get all the functionality of an interface in a 100% abstract class, why even use an interface?

Thanks.


if you use interfaces to define a contract, then if you change the interface in future, you have to implement the changes in all the classes which implement the interface.

but in a abstract class, you can add concrete methods without needing to make changes in classes which extend the abstract class, thus if your contract is gonna change too often , you should use a abstract class to have the base contract + any specialized additional contract features.

And about what a interface can do that a 100% abstract class cannot ? its easy, a interface can extend n numbers of other interfaces, which makes it easy to define a contract based on many other smaller contracts.


SCJP 1.6 ,SCWCD 5
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Interview questions for Java developer, Struts, EJBs
 
Similar Threads
How do I pass job interviews?
Servlets and JSPs Interview Questions
More interview questions
Servlets and JSPs Interview Questions
Interview questions