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 / monika watts

STATIC VARIABLE: static variable is that variable that is
shared by all the objects of a class.means allocates memory
once even if we create any no of objects and even if we
create no object.
STATIC METHOD: first thing about static method is that we
can access static variables only with in static method.
and static methods can be called without the object of that
class.
let
class a
{
static void hello()
{
System.out.println("hello friend");
}
}
now we can access this method as hello() or a.hello();
without any object or with class name.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we use string in switch case in java?

1129


Can a main method be overloaded?

1067


Where to store local variables?

1152


What is the difference between logical data independence and physical data independence?

1084


What is toarray method in java?

1165


What is a return in java?

1075


What does n mean in java?

1016


What is broken and continue statement?

1061


How do I enable java in safari?

1092


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?????

2316


How many ways can we create the string object?

1062


In the below example, what will be the output?

1080


Is singleton class thread safe?

1052


take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).

2039


What are the main uses of the super keyword?

1016