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

What is jpa specification?

961


Are generics important java?

968


what is object-oriented programming in java?

1041


Can an arraylist be empty?

1047


What are the benefits of immutable objects?

996


What is the importance of main method in Java?

1055


what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????

2260


What is bubble sorting in java?

1035


Explain the transient field modifier?

1033


What is the difference between && and & in java?

1075


Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.

1303


What is meant by oops concept in java?

985


What are different types of states exist for a thread?

1008


What are the restrictions that are applied to the java static methods?

981


Is list thread safe in java?

917