+ 1
What is short explanation of override in java
Override
3 ответов
+ 4
Serena Yvonne
Yup
Sorry....didn't read the question properly
+ 3
He my answer....
Just remember, In Java
non-static methods are overridden
static methods are hidden
the method in the child class must have the same signature as that of parent class
//example
class Abc
{
public void display()
{
System.out.print("Hello");
}
}
public class Main extends Abc
{
@Override
public void display()
{
System.out.println("World!!");
}
public static void main(String args[])
{
Main ref = new Main();
ref.display();
}
}
Output will be World!!
here you just override the display() of parent class with the display() of child class