Originally posted by Satheesh Kumar:
Hai
I found this question in "sun site " for "has a " relationship..,
now can anyody help me out in this question
Which two demonstrate a "is a" relationship?
a. public interface Person{ }
public class Employee extends Person{ }
b. public interface Shape{ }
public interface Rectangle extends Shape{ }
c. public interface Colorable{ }
public class Shape implements Colorable{ }
d. public class Species{ }
public class Animal{private Species species;}
e. interface Component{ }
class Container implements Component{
private Component[] children;
}
Originally posted by Sivaram Ghorakavi:
Q20) Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program??
class A {}
class B extends A{}
class C extends C{}
public class Q3ae4
{
public static void main(String args[])
{
A x = new A();
B y = new B();
C z = new C();
// insert statment here
}
}
Select all valid answers.
a) x = y;
b) z = x;
c) y = (B)x;
d) z = (C)y;
e) y = (A)y;
BOL