Java - Explain upcasting and
downcasting in Java. - March 16, 2010 at 15:05 PM by Vidya Sagar
Explain upcasting and downcasting in Java.
Upcasting: Java permits an object of a sub
class can be referred by its super class. It is done automatically.
Downcasting: It is to be performed manually
by the developers. Here explicit casting is to be done by the super class. For
Shape shape = new Shape() ;
circ = (Circle) shape;
where shape is a super class object. Now the methods of Shape
can be invoked by the reference variable circ.
An event-listener interface allows describing the methods which must be
implemented by one of the event handler for a specific event..................
Preemptive scheduling enables the highest priority task execution until waiting
or dead states entered. It also executes, until a higher priority task
string object that is created using “String” class is immutable. The characters
of the object can not be changed / modified. There are some methods, such as
split(), substring(), beginsWith() etc...................