Organizational Research By

Surprising Reserch Topic

in core-java how Can an abstract class have static methods?


Yes, definitely can have as a static method is special flavor of concrete method. We know a static method can be called with object name (not possible here), class name and directly without the help of an object. Following program explains.
 
abstract class Test
{
  public static void display()
  {
    System.out.println("Hello 1");
  }
}
public class Demo extends Test
{
  public static void main(String args[]) 
  {
    display();
    Test.display();
  }
}
 
In the above code, the display() method is declared static. It is called in the subclass directly and with abstract class name.
 
asked Sep 13, 2013 in Core java by itkbc
edited Sep 12, 2013
0 votes
34 views



Related Hot Questions



Government Jobs Opening


...