You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
public static void main(String[] args) { cycle c = new cycle(); c.print(); }
}
class Motorcycle{ public void print(){ System.out.println("Hello I am a motorcycle, I am a cycle with an engine.");
};
} class cycle extends Motorcycle{ @Override public void print(){ super.print();
System.out.println("My ancestor is a cycle who is a vehicle with pedals.");
Seems like cookies are disabled on this browser, please enable them to open this website
Java Method Overriding 2 (Super Keyword)
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
}
class Motorcycle{ public void print(){ System.out.println("Hello I am a motorcycle, I am a cycle with an engine.");
} class cycle extends Motorcycle{ @Override public void print(){ super.print();
}
}