• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interview questions for Java developer, Struts, EJBs

 
Gina vernon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Gina for posting these questions. I didn't know about the weak references. Now got it.

Keep up the good work.

Avi Sinha
 
Jeevan Reddy
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting them. It should be useful to us
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic