class Parent
{
int ml(){
System.out.println("Parent m1");
return 200;
}
}
class Child extends Parent
{
int m1(){
System.out.println("Child m1");
return 100;
}
}
class Demo
{
public static void main(String[] args)
{
System.out.println("Hello Wo");
Child c1 = new Child();
int a=c1.m1();
// you are returning Parameters
//type int so Both Parent and Child method return type is same as primitive level.
// ex boolean m1()- true
// boolean m1() - false is same as data type
System.out.println(a);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter