you need to include a } at the end
2. inside the static block, j should also have a type specifier as; int j = 6 (or) int i = ...,j=...;
3. you don't need to use the this keyword inside the constructor
4. you cannot access the variable k that is inside the static block inside the constructor. Basically any static member should be accessed from any other static block or method or directly through the class.
I would suggest you brush up with the basics of java before continuing with your coding.
I could have been check this twice or thrice before sending it.......... I have marked a brace at the end of snip.
The code has been compiled when int k is static but when i am putting k in a static block it hasn' been compiled...please specify the reason...... I am a newcomer to java.
The reason it fails because the variable K is not available in StaticTest method.
If you declare any variable inside block or method then that variable is avaliable only inside that block or method unless you pass the reference out of the mrthod.
But if you declare your variable in a class and outside any of the code block or method then all the methods and code blocks inside that class can access it either by using reference or directly which depends on variable type (class or instance).
So in your case your variable k has lifetime only during the code block runs and then it dies and no more avaialbe.
But if you would have declared it inside the class and outside any of the method or code block you could use it anywhere in the class.