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

What are design patterns and please explain?

564


What is the use of pattern in java?

502


What is singleton pattern?

546


What does 0 mean in boolean?

533


What are java methods?

564






What is jvm? How its run?

648


Why does java have different data types for integers and floating-point values?

525


What is sizeof () operator?

564


Differentiate between stringbuffer and string?

587


How do you create a reference in java?

506


What is a java predicate?

526


Difference between java and javascript

578


How do you remove duplicates from an array in java?

522


What is the main difference between java platform and other platforms?

497


What is foreach loop in java?

519