India,Desi,Discussion Forum Board Astrology, Jobs

Go Back   India,Desi,Discussion Forum Board Astrology, Jobs > Career and Jobs > Interview Tips and Tricks
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-08-2008, 10:23 AM
bharath bharath is offline
Member
 
Join Date: Mar 2008
Posts: 76
Default Java Interview - Static In Java

1. What is static in java?

2. How is it possible for two String objects with identical values not to be equal under the == operator?
Reply With Quote
  #2 (permalink)  
Old 05-10-2008, 09:59 AM
ram101 ram101 is offline
Senior Member
 
Join Date: Jun 2007
Posts: 270
Default

Static in Java

1 .- Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.

2. The == operator compares two objects to determine if they are the same object in memory i.e. present in the same memory location. It is possible for two String objects to have the same value, but located in different areas of memory.
Reply With Quote
Reply


Thread Tools
Display Modes

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

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



AddThis Social Bookmark Button
All times are GMT. The time now is 10:19 PM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0