Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is static variable and static method?

Answer Posted / viral

class A
{ static int a;
}

class StaticDemo
{ public static void main(String args[])
{ A obj1 = new A();
A obj2 = new A();
}
}

In such a case, objects obj1 and obj2 will not have
different copies of variable a. Both objects will refer to
the same "a". In simpler words, copy of "a" is not created.

If "a" was not static, then obj1 and obj2 would hold
different copies of "a".

Is This Answer Correct ?    14 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you need to import math in java?

1055


What does g mean in regex?

1031


What super () does in java?

963


What is static keyword?

1239


Can you give names of Container classes?

2349


What technique can be employed to compare two strings?

1170


What are different data types?

1073


What are implicit objects in java?

1019


What is the latest version of java?

1204


What are the concepts of 'OOPS'?

1113


How does the java compiler work?

1031


how to open and edit XML file in Weblogic???

2005


What is variable and rules of variable?

1062


What is jagged array in java?

1145


What do heavy weight components mean in java programming?

993