Win a copy of Fixing your Scrum this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Important java interview Qs

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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???
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answering 7 can start a Holy war! Java is pass by value always! http://www.javaranch.com/campfire/StoryPassBy.jsp
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We can apply static, private, protected only to an inner Class.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic