Hello,
I read the book for the following statement
�The static instance variables are accessed by static method�
But the below example non- static method accessing statis instance variable (�S�), is it possible to do like this.
13. Given the following,
1. class
Test {
2. static int s;
3.
4. public static void main(
String [] args) {
5. Test p = new Test();
6. p.start();
7. System.out.println(s);
8. }
9.
10. void start() {
11. int x = 7;
12. twice(x);
13. System.out.print(x + " ");
14. }
15.
16. void twice(int x) {
17. x = x*2;
18. s = x;
19. }
20. }