Examlex
class InstanceofDemo
{
public static void main(String[] args)
{
Parent object1 = new Parent();
Parent object2 = new Child();
System.out.println("object1 instanceof Parent: "
+ (obj1 instanceof Parent));
System.out.println("object1 instanceof Child: "
+ (obj1 instanceof Child));
System.out.println("object1 instanceof MyInterface: "
+ (obj1 instanceof MyInterface));
System.out.println("object2 instanceof Parent: "
+ (obj2 instanceof Parent));
System.out.println("object2 instanceof Child: "
+ (obj2 instanceof Child));
System.out.println("object2 instanceof MyInterface: "
+ (obj2 instanceof MyInterface));
}
}
The above code defines a parent class (named Parent ), a simple interface (named MyInterface ), and a child class (named Child ) that inherits from the parent and implements the interface.
Following program execution, what will be the output of the six println statements?
Disbursements Fund
A fund set aside for the payment of expenses or disbursement of funds for specific purposes as they arise.
Q14: In Boolean expressions, when you want to
Q35: When array elements are passed by value,
Q44: Write the code for bubble sorting a
Q46: A(n) _ is a collection of fields
Q47: Give an example of how you can
Q48: When setting a JFrame 's size, part
Q52: In the case where a method might
Q59: The String class _ method accepts an
Q65: You are not required to use an
Q67: StringBuilder greeting = new StringBuilder("Hello, John"); <br>char