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

Which programming language is most secure?

1000


What is the java project architecture?

2248


Write a program to find the whether a number is an Armstrong number or not?

1034


Is list thread safe in java?

925


What is difference between path and classpath variables?

1097


What is time complexity java?

996


What is the transient keyword?

2181


Why we use methods in java?

1002


Is singleton class immutable?

971


What is meant by method overriding?

1113


How many wrapper classes are there in java?

1012


What is length in java?

1019


Can a constructor be made final?

1112


What are the differences between c++ and java?

1141


Can we modify the throws clause of the superclass method while overriding it in the subclass?

1037