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 a dot notation?

954


Can we sort array in java?

886


What is consumer in java?

918


How to store image in arraylist in java?

919


What is parsing in grammar?

977


Which eclipse is best for java?

954


What happens when a thrown exception is not handled?

1049


What is anti pattern in cyber security?

956


What is skeleton and stub?

983


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

1031


What is the syntax and characteristics of a lambda expression? Explain

992


What is are packages?

981


Difference between overriding and overloading in java?

1005


What is classpath?

954


What is the size of arraylist in java?

973