- 3
Write a java program which includes the inheritance, Super keyword, Method Overloading, Method Overriding concept, Abstract k
Can anyone suggest me the program pls mention crct program with crct execution
3 Answers
0
System.out.println(42);
Please show your attempt and write your problem more clear
0
Looks like someone waited to the last minute to study for something...
If I'm wrong, then paste or link your attempt. If I'm right, however, you won't find a remedy for your procrastination here.
0
Tell me it's showing errors ..can anyone send the decoded program
Please
MainClass.java
Program:
class One {
public void display() {
System.out.println("One");
}
}
//inheritance
class Two extends One {
public void display() {
System.out.println("Two");
}
public int add(int x, int y) {
return x+y;
}
//Overload
public double add(double x,double y) {
return x+y;
}
}
//encapsulation example
class EncapTest {
private String name;
public String getName() {
return name;
}
public void setName(String newName) {
name = newName;
}
}
//abstraction
abstract class TwoWheeler {
public abstract void run();
}
class Honda extends TwoWheeler{
public void run(){
System.out.println("\nbike is Running..");
}
}
class MainClass {
public static void main(String[] args) {
One a=new One();
a.display();
Two b=new Two();
b.display();
S