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

Which number is denoted by leading 0x or 0x in java?

1045


Differentiate between postfix and prefix operators in java.

1127


What is array class in java?

1069


How do you access command-line arguments within the code?

1060


What are the advantages of encapsulation in java?

1012


What are the steps involved to create a bean?

1158


What is the use of arraylist in java?

1094


Can we use synchronized block for primitives?

1073


What is tree node in java?

963


What do you mean by platform independence? What is an interface?

1035


Why we use protected in java?

976


Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?

1008


Define inheritance?

1018


What is the difference between jvm and jre? What is an interface?

1100


What do you mean by default constructor in java?

1071