+ 1

What is short explanation of override in java

Override

11th Mar 2019, 1:56 PM
Aditya Tiwari
Aditya Tiwari - avatar
3 ответов
+ 4
Serena Yvonne Yup Sorry....didn't read the question properly
11th Mar 2019, 2:54 PM
Rishi Anand
Rishi Anand - avatar
+ 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
11th Mar 2019, 3:02 PM
Rishi Anand
Rishi Anand - avatar