why we cannot declare static variable inside a static method
Answers were Sorted based on User's Feedback
Answer / ravikiran
Because all the variales inside static method are by
default static
| Is This Answer Correct ? | 15 Yes | 4 No |
Answer / srinu
generally all variables inside static method treated as
static
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / sachin kanojiya
Static variable initializes at the time of class load
(static variable initialize very first,after that static
method)that means static variable and method already define
but inside the static method can't declare static variable
because it is treat as static local member...
| Is This Answer Correct ? | 5 Yes | 4 No |
Answer / swamireddy
STATIC VARIABLES ARE DECLARED CLASS DIFINITION ONLY
WITHOUT DECLARE THE WITHIN STATIC METHODS.THE STATIC
METHODS ARE ONLY USE THE STATIC VARIABLES.
| Is This Answer Correct ? | 2 Yes | 2 No |
What are order of precedence and associativity, and how are they used?
What is the method overriding?
what is the form of storage space in java?
How many bytes is 255 characters?
When do we need to use internal iteration? When do we need to use external iteration?
Why do we need data serialization?
Difference between operator overloading and function overloading
0 Answers Tavant Technologies, Virtusa,
Differentiate between nested and inner class in java.
0 Answers Akamai Technologies,
Why const and goto are reserved keyword in java?
Is java an open source?
What is early binding and late binding in java?
What is ellipsis in java?