Can you declare a static variable in a method?

Answer Posted / venkatesh

No we can't declare a static variable in a method.
only final and default scope variables are allowed inside
the method

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can main() method in java can return any data?

642


Explain how can you debug the Java code?

586


When will you define a method as static?

553


What is the syntax and characteristics of a lambda expression?

552


What are the different access modifiers available in java?

557






How do you create a bulleted list?

561


Can constructor be synchronized?

536


Can a class have multiple subclasses?

581


Can we overload the main() method?

545


Is array size fixed in java?

534


What is the default size of load factor in hashing based collection?

558


What is array sorting in java?

550


What does pointer mean?

544


What is the difference between an array and an array list?

500


How java is similar to c?

584