Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > JAVA Technologies
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 12-06-08, 02:19 PM   #1 (permalink)
Member
 
vijayrmca's Avatar
 
Join Date: Jun 2008
Age: 24
Posts: 72
Thanks: 2
Thanked 27 Times in 20 Posts
Thanks: 2
Thanked 27 Times in 20 Posts
Blog Entries: 2
Rep Power: 3 vijayrmca is on a distinguished road vijayrmca is on a distinguished road vijayrmca is on a distinguished road
Core Java Questions Interview Ques n Answers-IV

Question: Explain garbage collection ?
Answer: Garbage collection is an important part of Java's security strategy. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects from the memory. The name "garbage collection" implies that objects that are no longer needed by the program are "garbage" and can be thrown away. A more accurate and up-to-date metaphor might be "memory recycling." When an object is no longer referenced by the program, the heap space it occupies must be recycled so that the space is available for subsequent new objects. The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.
Question: How you can force the garbage collection ?
Answer: Garbage collection automatic process and can't be forced. We can call garbage collector in Java by calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected.
Question: What are the field/method access levels (specifiers) and class access levels ?
Answer: Each field and method has an access level:
  • private: accessible only in this class
  • (package): accessible only in this package
  • protected: accessible only in this package and in all subclasses of this class
  • public: accessible everywhere this class is available
Similarly, each class has one of two possible access levels:
  • (package): class objects can only be declared and manipulated by code in this package
  • public: class objects can be declared and manipulated by code in any package
Question: What are the static fields & static Methods ?
Answer: If a field or method defined as a static, there is only one copy for entire class, rather than one copy for each instance of class. static method cannot accecss non-static field or call non-static method

Example Java Code

static int counter = 0;

A public static field or method can be accessed from outside the class using either the usual notation:

Java-class-object.field-or-method-name

or using the class name instead of the name of the class object:

Java- class-name.field-or-method-name

Question: What are the Final fields & Final Methods ?
Answer: Fields and methods can also be declared final. A final method cannot be overridden in a subclass. A final field is like a constant: once it has been given a value, it cannot be assigned to again.

Java Code

private static final int MAXATTEMPTS = 10;

Question: Describe the wrapper classes in Java ?
Answer: Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type.

Following table lists the primitive types and the corresponding wrapper classes:

Primitive
Wrapper
boolean
java.lang.Boolean
byte
java.lang.Byte
char
java.lang.Character
double
java.lang.Double
float
java.lang.Float
int
java.lang.Integer
long
java.lang.Long
short
java.lang.Short
void
java.lang.Void
__________________
The early years were more about learning than about acting. I had to carry on my father’s work, which was a big challenge.
Azim Premji
vijayrmca is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to vijayrmca For This Useful Post:
narayanarao1983 (01-07-08)
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
JAVA WEB SITES yathish JAVA Technologies 2 20-11-08 12:11 AM
tips for interview ozobalu HR Questions 9 23-09-08 12:32 AM
Dug it yathish Companies Info & Recruitment Process 4 10-09-08 06:25 PM
Interview Questions Pink Other Queries 15 20-08-08 03:37 AM


All times are GMT +6.5. The time now is 03:03 AM.





Search Engine Optimization by vBSEO 3.1.0