Advertisement
Guest User

Untitled

a guest
Jul 13th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. package interinher;
  2.  
  3. public interface InterfaceCar {
  4.  
  5. void color(String c);
  6. void gearbox(String t);
  7. }
  8.  
  9. class Honda implements InterfaceCar{
  10.  
  11. public void color(String c)
  12. {
  13. c="Black";
  14. }
  15. public void gearbox(String t)
  16. {
  17. t="manual1";
  18. }
  19. }
  20.  
  21. class Maruti implements InterfaceCar {
  22.  
  23. public void color(String c)
  24. {
  25. c="Blue";
  26. }
  27. public void gearbox(String t)
  28. {
  29. t="automatic1";
  30. }
  31.  
  32. }
  33.  
  34. class City extends Honda{
  35.  
  36. public void color(String c)
  37. {
  38. c="green";
  39. }
  40. public void gearbox(String t)
  41. {
  42. t="manual2";
  43. }
  44.  
  45. }
  46.  
  47.  
  48. class Civic extends Honda{
  49.  
  50. public void color(String c)
  51. {
  52. c="red";
  53. }
  54. public void gearbox(String t)
  55. {
  56. t="automatic2";
  57. }
  58. }
  59.  
  60. class Swift extends Maruti{
  61.  
  62. public void color(String c)
  63. {
  64. c="Blue";
  65. }
  66. public void gearbox(String t)
  67. {
  68. t="automatic3";
  69. }
  70. }
  71.  
  72. class Omni extends Maruti{
  73. public void color(String c)
  74. {
  75.  
  76. System.out.println(c);
  77. }
  78. public void gearbox(String t)
  79. {System.out.println(t);
  80. }
  81.  
  82. }
  83.  
  84.  
  85. class printer{
  86.  
  87. public static void main(String[] args)
  88. {
  89. Omni omni = new Omni();
  90. omni.color("sngkjsg");
  91. omni.gearbox("autom");
  92.  
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement