aspose file tools*
The moose likes Java in General and the fly likes Important java interview Qs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Important java interview Qs" Watch "Important java interview Qs" New topic
Author

Important java interview Qs

Nag Rao
Greenhorn

Joined: Aug 11, 2003
Posts: 3
Hi all,
I came across the following interview questions in some other forum. Can somebody discuss the answers so that it will be useful for all?.
1.Can you apply static, private, protected to a Class and a Constructor?Reasons.
2.What is finalize() method? why is it protected?
3.what is singleton and use of it?
4.what are joins in db? differentiate inner and outer joins.//db question
5.Are there virtual functions in java like in C++?
6.What is java reflection API?
7.Is java pass by val or pass by ref.explain.
8.What is serialization in java.
thanks,
Nag.
O. Subramaniam
Greenhorn

Joined: Aug 04, 2003
Posts: 17
Reflection:
Querying a class about its methods and properties is called Reflection.Reflection API is use dot achieve this.
Serialization:
Is the method of converting complex objects into a stream of bytes.
Jatin Kumar
Greenhorn

Joined: Aug 12, 2003
Posts: 1
I think finalize() method in an object is used to clean up the resources before the object gets garbage collected.It is called just before GC.I don't know why it is a Protected method?
Singleton pattern is designed for creating only one instance of a class so that the remaining apps can share that single object.Connection pool is an example.ANy other examples???
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Answering 7 can start a Holy war! Java is pass by value always! http://www.javaranch.com/campfire/StoryPassBy.jsp


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Sanjay Saxena
Ranch Hand

Joined: Dec 12, 2001
Posts: 81
Can you apply static, private, protected to a Class and a Constructor? Reasons

A static member is always associated to a class NOT to an instance(object) of the class as we know constructors are used to construct an instance. So we can not apply static to a constructor. They both are meant for different purposes.

If a constructor is private that means that constructor can only be used within the same class. This means other classes can not instantiate this class. Private constructors are usually used to create Singleton objects.
I think protected constructor is a valid but then this class can only be instantiated by the subclasses.
Sanjay Saxena
Ranch Hand

Joined: Dec 12, 2001
Posts: 81
We can apply static, private, protected only to an inner Class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Important java interview Qs