Can you declare a static variable in a method?

Answer Posted / aravinda reddy

No we can't declare a static variable in a method or static
method, static variables are class level variables. Static
means one per class as per OO rules and method level
variables scope is with in the method. So if java allows
static variable inside a method, static concept is useless.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the selection sort algorithm?

865


Explain the scope or life time of class variables or static variables?

748


How to implement a multithreaded applet?

2433


What do you mean by an interface in java?

778


What is data type example?

766


How to read and write image from a file ?

810


What is a dynamic array java?

727


Why do we need autoboxing in java?

770


What is string args [] in java?

777


does java support pointers?

761


What does escaping a character mean?

739


What are the advantages of java inner classes?

788


What is high level language in computer?

763


Why does java have two ways to create child threads?

694


Explain jdk, jre and jvm?

776