Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

functionality, you need to cast the object reference to a more specific typebut what type?

0
Posted

functionality, you need to cast the object reference to a more specific typebut what type?

0

forName method can create a new class type at run time, the way your code uses that class is still checked by the compiler, before your program has a chance to run. This restricts your code to using the new class and its instances only in terms of a superclass or interfaces that the compiler can check. For example, suppose that myPackage.myClass in the previous code fragment implements the Runnable interface, which contains the single method run.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123