How to declare static variable and static method in abstract class using Java

1 Answer

0 votes
abstract class Test {  
    static int i = 892;  
    static void test_method() {  
            System.out.println("abstract class Test - test_method()");  
        }  
}  
public class B extends Test {  
    public static void main (String args[]) {  
        B.test_method();  
        
        System.out.println(Test.i);  
    }  
} 



/*
run:

abstract class Test - test_method()
892

*/

 



answered Oct 4, 2019 by avibootz

Related questions

1 answer 203 views
1 answer 220 views
1 answer 200 views
2 answers 239 views
2 answers 377 views
377 views asked Jul 4, 2017 by avibootz
1 answer 141 views
...