Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package interinher;
- public interface InterfaceCar {
- void color(String c);
- void gearbox(String t);
- }
- class Honda implements InterfaceCar{
- public void color(String c)
- {
- c="Black";
- }
- public void gearbox(String t)
- {
- t="manual1";
- }
- }
- class Maruti implements InterfaceCar {
- public void color(String c)
- {
- c="Blue";
- }
- public void gearbox(String t)
- {
- t="automatic1";
- }
- }
- class City extends Honda{
- public void color(String c)
- {
- c="green";
- }
- public void gearbox(String t)
- {
- t="manual2";
- }
- }
- class Civic extends Honda{
- public void color(String c)
- {
- c="red";
- }
- public void gearbox(String t)
- {
- t="automatic2";
- }
- }
- class Swift extends Maruti{
- public void color(String c)
- {
- c="Blue";
- }
- public void gearbox(String t)
- {
- t="automatic3";
- }
- }
- class Omni extends Maruti{
- public void color(String c)
- {
- System.out.println(c);
- }
- public void gearbox(String t)
- {System.out.println(t);
- }
- }
- class printer{
- public static void main(String[] args)
- {
- Omni omni = new Omni();
- omni.color("sngkjsg");
- omni.gearbox("autom");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement