0

Can we acces in same class static block element outside of block ?

I firstly declared static block with some variable defined inside it but when I was try to access in operation it does not found variable by the compile time error..... please reply early

4th Jun 2017, 6:52 AM
Shyam Lal Chauhan
3 Answers
0
I think we can't access maybe right or wrong
4th Jun 2017, 6:53 AM
Shyam Lal Chauhan
0
class A{ static { int a=10,b=3;} public static void main(String[] args){ System.out.println(a+b); } }
4th Jun 2017, 7:14 AM
Shyam Lal Chauhan
0
with constructor is it possible
4th Jun 2017, 8:03 AM
Shyam Lal Chauhan