📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (176K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
Check out all the Java daily quiz questions at https://www.javaguides.net/p/java-daily-quiz.html.
Check out 200+ video tutorials on my YouTube channel at https://www.youtube.com/c/javaguides.
Quiz 3 - What will be the output of the following Java program?
class Base {
public void test() {
}
}
class Base1 extends Base {
public void test() {
System.out.println("Base1");
}
}
class Base2 extends Base {
public void test() {
System.out.println("Base2");
}
}
class Test {
public static void main(String[] args) {
Base obj = new Base1();
((Base2) obj).test(); // CAST
}
}
Answer
d) The program will result in an exception (ClassCastException).
Check out all the Java daily quiz questions at https://www.javaguides.net/p/java-daily-quiz.html.
Check out 200+ video tutorials on my YouTube channel at https://www.youtube.com/c/javaguides
Comments
Post a Comment
Leave Comment