logo

Crowdly

Browser

Add to Chrome

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

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

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%
More questions like this

Want instant access to all verified answers on online.upr.edu?

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

Browser

Add to Chrome