logo

Crowdly

Browser

Add to Chrome

Folgender Code ist gegeben. Welche Ausgabe erzeugt der Code in der main-Methode ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Folgender Code ist gegeben. Welche Ausgabe erzeugt der Code in der main-Methode der App-Klasse?

public class A {

   public void ausgeben(String s)

   {

       System.out.println("A sagt: " + s);

   }

}
public class B extends A {

   public void nachrichtAusgeben(String s)

   { 

       System.out.println("B sagt: " + s);

super.ausgeben(s);

   }

}

public class C extends A {  

public void ausgeben(String s)

   {

       System.out.println("C sagt: " + s);

   }

}

import java.util.ArrayList;

public class App {

  

public static void main (String[] args)

 { 

        A v1 = new A();

A v2 = new B();

A v3 = new C();

ArrayList<A> liste = new ArrayList<>();

liste.add(v1);

liste.add(v2);

liste.add(v3);

for(A element : liste)

{

element.ausgeben("Hallo");

}

  }

}

More questions like this

Want instant access to all verified answers on moodle.tsn.at?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome