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

Can you declare a static variable in a method?

Answer Posted / murali

No, Static variables can be declared as a class attributes,
for example,
public classA{
static String m2="xyz"; // this is correct form
public static void main(String args[]){
static String m1="abc"; // this gives an error
(illegal modifier for parameter;;....)
}
}

Is This Answer Correct ?    25 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are measurable parameters?

1068


What is a conditional equation?

1037


What is runtime polymorphism or dynamic method dispatch?

1004


Is logger a singleton?

944


What is the generic class?

960


What is method overloading with type promotion?

1260


What methodology can be employed to locate substrings inside a string?

957


What modifiers are allowed for methods in an interface?

1151


Is a method a function?

1049


What is the primary benefit of encapsulation?

1080


What is the intersection and union methods?

1014


Is ++ operator is thread safe in java?

949


What do you mean by constructor?

976


Why chararray() is preferred over string to store the password?

1020


What is the biggest integer?

1044