1Z0-808 (Java 8 OCA) : Java Inheritance and Polymorphism


1Z0-808 (Java 8 OCA) : Java Inheritance and Polymorphism
Using diagrams to explain what is really going on in Java Inheritance/Polymorphism

What you will learn

Inheritance

Overriding

Polymorphism

Upcasting/Downcasting

Data hiding

Covariant Returns

Exception signatures when overriding methods

Reference type determining accessible methods

ClassCastExceptions

Overloading

Description

This is one category (of eleven) from my systematic preparation course for the 1Z0-808 Oracle Java SE 8 Programmer 1 (OCA)┬аexam which I have delivered several times; both in person and online.

This Inheritance course is not a notes-based course. As the Oracle exam is based on multiple choice questions (MCQ), this course focuses completely on MCQ using the excellent Enthuware tool. In fact, Enthuware supplement their explanations by referring to my online explanations.

‘;
}});

In this course, I answer 20 random┬аquestions from EnthuwareтАЩs Inheritance category and use diagrams and code where needed. The diagrams in particular are extremely helpful when explaining Inheritance-related concepts. For example, a UML┬аdiagram helps greatly with explaining why a reference of type Car cannot refer to an object of type Vehicle. The other type of diagram I┬аuse frequently is the in-memory representation of references referring to objects. Separating these two concepts (references and objects)┬аis critical to answering many MCQ-style questions.


While the course is ideal for those preparing for the 1Z0-808 exam, the topics discussed will benefit anyone trying to understand Inheritance at a deeper level. For example, the following topics are all covered:

  • method overriding
    • polymorphism
    • covariant returns
    • where the parent method throws exceptions
  • method overloading
  • upcasting and downcasting
  • shadowing тАУ both methods and data
  • the reference type determines the methods accessible
  • the default modifiers applied to interface data
  • the types of methods allowed in interfaces
  • why an abstract class can implement an interface without implementing any of the interfacesтАЩ methods
  • ClassCastExceptions

Introduction

Introduction

Inheritance

2.1291 тАУ reference type determines the data you can access.
2.970 тАУ diagrams discussing overriding, polymorphism, reference vs object type.
2.1086 тАУ diagrams explaining covariant returns and reference vs. object types.
2.996 тАУ the reference type determines the methods you can call (diagrams).
2.1150 тАУ interface methods must be public and abstract (if no method body code).
2.1072 тАУ ambiguous fields only become an issue if you use them.
2.1399 тАУ getClass() returns the class of the object that the reference refers to
2.1320 тАУ reference type determines the data accessed (static or non-static).
2.1056 тАУ final classes cannot be subclassed.
2.1019 тАУ overriding compared to overloading
2.1015 тАУ trying to access private data defined higher up the inheritance tree.
2.1144 тАУ interface fields are implicitly public, static and final.
2.1476 тАУ recognizing valid interface methods.
2.1149 тАУ assignments that fail to compile or generate ClassCastExceptions.
2.1481 тАУ extending interfaces
2.931 тАУ static methods cant be overridden by non-static methods (and vice versa)
2.900 тАУ interfaces can extend from multiple interfaces.
2.1009 тАУ a reference to a static field initialises the class that declares it.
2.1231 тАУ abstract classes can implement interfaces without providing any methods
2.839 тАУ overriding a method that defines an exception in its method signature.

Conclusion

Thanks

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO

Check Today's 30+ Free Courses on Telegram!

X