logo

Crowdly

Browser

Додати до Chrome

If we had the following implementations: public interface InterfaceA {     publ...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

If we had the following implementations:

public interface InterfaceA {

    public void printLetter();

}

public class ClassB implements InterfaceA {

    @Override

    public void printLetter() {

        System.out.println("B");

    }

}

public class ClassC implements InterfaceA {

    @Override

    public void printLetter() {

        System.out.println("C");

    }

}

If we intialize the following variable:

Interface a = new ClassB();

ClassB b = new ClassB();

ClassC c = new ClassC();

Are these valid usage of casting?

ClassB b2 = (ClassB) a;

InterfaceA a2 = (InterfaceA) c;

0%
0%
0%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на online.upr.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome