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) | 3,156 Views |
Access specifiers: “public”, “protected”, “private”, nothing?
Read Answers(6) | 3,928 Views |
How does Java inheritance wor?k
Read Answers(4) | 4,181 Views |
How many different types of JDBC drivers are present? Discuss them.
Read Answers(21) | 10,472 Views |
What does the “static” keyword mean in front of a variable? A method? A class? Curly braces {}?
Read Answers(6) | 4,684 Views |
What are native methods? How do you use them?
Read Answers(4) | 3,997 Views |
What are java beans?
Read Answers(5) | 3,874 Views |
What is RMI?
Read Answers(2) | 3,241 Views |
What is the difference between an Applet and an Application?
Read Answers(2) | 3,861 Views |