Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. package me.magicced01.test;
  2.  
  3. public class Kraftfahrzeug {
  4. private int gewicht;
  5.  
  6. public Kraftfahrzeug(int gewicht) {
  7. this.setGewicht(gewicht);
  8. }
  9.  
  10. public int getGewicht() {
  11. return gewicht;
  12. }
  13.  
  14. public void setGewicht(int gewicht) {
  15. this.gewicht = gewicht;
  16. }
  17.  
  18. }
  19.  
  20.  
  21. package me.magicced01.test;
  22.  
  23. public class Auto extends Kraftfahrzeug{
  24. private int geschwindigkeit;
  25.  
  26. public Auto(int gewicht, int geschwindigkeit) {
  27. super(gewicht);
  28. this.geschwindigkeit = geschwindigkeit;
  29. // TODO Auto-generated constructor stub
  30. }
  31.  
  32. public int getGeschwindigkeit() {
  33. return geschwindigkeit;
  34. }
  35.  
  36. public void setGeschwindigkeit(int geschwindigkeit) {
  37. this.geschwindigkeit = geschwindigkeit;
  38. }
  39.  
  40.  
  41.  
  42.  
  43. }
  44.  
  45. package me.magicced01.test;
  46.  
  47. public class Main {
  48. public static void main(String args[]) {
  49. Auto auto = new Auto(1000,100);
  50. System.out.println(auto.getGewicht());
  51. System.out.println(auto.getGeschwindigkeit());
  52.  
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement