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 191 views
1 answer 202 views
1 answer 198 views
2 answers 227 views
2 answers 361 views
361 views asked Jul 4, 2017 by avibootz
1 answer 131 views
...