Since C is the base class, it can’t be casted to A. Class cast exception will happen.
If I cast A to C and then call foo(), the a.foo() will only get executed.
Read Answer(1) | 2,449 Views |
Access specifiers: “public”, “protected”, “private”, nothing?
Read Answers(6) | 3,091 Views |
How does Java inheritance wor?k
Read Answers(4) | 3,283 Views |
How many different types of JDBC drivers are present? Discuss them.
Read Answers(21) | 7,145 Views |
What does the “static” keyword mean in front of a variable? A method? A class? Curly braces {}?
Read Answers(6) | 3,798 Views |
What are native methods? How do you use them?
Read Answers(4) | 3,145 Views |
What are java beans?
Read Answers(5) | 3,010 Views |
What is RMI?
Read Answers(2) | 2,466 Views |
What is the difference between an Applet and an Application?
Read Answers(2) | 3,020 Views |