Edit Autoradio
This commit is contained in:
		
							parent
							
								
									ff367a664b
								
							
						
					
					
						commit
						e8ed1dc746
					
				| 
						 | 
					@ -9,6 +9,7 @@ public class Auto {
 | 
				
			||||||
    public String farbe;
 | 
					    public String farbe;
 | 
				
			||||||
    public int tueren;
 | 
					    public int tueren;
 | 
				
			||||||
    public List<Rad> raeder;
 | 
					    public List<Rad> raeder;
 | 
				
			||||||
 | 
					    public Autoradio radio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Auto(String hersteller, int leistung, String farbe, int tueren) {
 | 
					    public Auto(String hersteller, int leistung, String farbe, int tueren) {
 | 
				
			||||||
        this.hersteller = hersteller;
 | 
					        this.hersteller = hersteller;
 | 
				
			||||||
| 
						 | 
					@ -26,6 +27,8 @@ public class Auto {
 | 
				
			||||||
        this.raeder.add(rad2);
 | 
					        this.raeder.add(rad2);
 | 
				
			||||||
        this.raeder.add(rad3);
 | 
					        this.raeder.add(rad3);
 | 
				
			||||||
        this.raeder.add(rad4);
 | 
					        this.raeder.add(rad4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.radio = new Autoradio();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void fahren(){
 | 
					    public void fahren(){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					package com.p4ddy.java_tutorial;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class Autoradio {
 | 
				
			||||||
 | 
					    public String sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Autoradio (){
 | 
				
			||||||
 | 
					        this.sender = "RadioBoB";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,8 @@ public class HelloWorld {
 | 
				
			||||||
        Auto auto1 = new Auto("Tesla", 500, "Rot", 5);
 | 
					        Auto auto1 = new Auto("Tesla", 500, "Rot", 5);
 | 
				
			||||||
        Auto auto2 = new Auto("Porsche", 1000, "Gelb", 3);
 | 
					        Auto auto2 = new Auto("Porsche", 1000, "Gelb", 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        auto2.radio.sender = "RadioJazz";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        System.out.println("Auto soll fahren");
 | 
					        System.out.println("Auto soll fahren");
 | 
				
			||||||
        auto1.fahren();
 | 
					        auto1.fahren();
 | 
				
			||||||
        auto1.fahren();
 | 
					        auto1.fahren();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user