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 the five major types of reference sources?
hi to all. well can you please tell me that why String class is immutable? Thanks in advance.
Differentiate between the constructors and methods in java?
if num=687; U have to get num=6+8+7;
What is the difference between C++ & Java?
78 Answers College School Exams Tests, HAL, SUN, Syntel, TCS, Wipro,
What is the maximum size of byte array in java?
Explain the difference between abstract class and interface in java?
What is string [] java?
If there are two notepad opened and working on it . is this a process or thread? computer based Live Example to differentiate between Thread , Process , and Multi tasking ?
What is assembly language?
What are white spaces in java?
What is Java exception handling?