Description:
In this course, you will focus on one of the most important concepts in all object-oriented programming for Java, the interface. Learners explore how anonymous inner classes provide lightweight instantiations of interfaces, and how interfaces are pure abstract entities. Begin with an introduction into using interfaces and how all their methods are abstract by default. Examine how the instanceof operator works the same way with interfaces as with classes. This leads on to combining the extends and implements keywords: implementing a derived class that can extend a base class and implement an interface. Then learners learn to set up two inheritance hierarchies and combine these into a set of objects that implement both sets of interfaces. Advanced features of interfaces are also examined. Learn how interfaces can support default method implementations. You will set up a class that implements some of the methods of an interface and declares itself abstract. Finally, you will create and define anonymous inner class objects and access outer class variables from your anonymous inner class.
Target Audience:
Duration: 01:10
Description:
In this course, you will learn about access modifiers that can be used to tag member variables and member functions inside Java classes to regulate how these can be accessed from different contexts. Participants begin by examining the properties of public, private, and protected access modifiers. These properties govern how classes, member functions, and member variables can be accessed within the same class, outside the same class but within the same package, and in entirely different packages. This leads into an examination of cross-package access and how access works from one package into another. You will then learn about the semantics of protected members, and the use of the protected access modifier. Next, explore the cross-package access of protected members, which enables you to use the protected keyword across packages. As the course concludes, you will learn about the semantics of using default access modifiers both inside and outside the same package.
Target Audience:
Duration: 00:56
Description:
In this course, participants learn about two specific and important aspects of Java—the final and abstract keywords. The final keyword can be used to mark member variables, member functions, and even entire classes, with different meanings in each context. You will discover how to mark variables as final, and the implications of doing so. Learn how to correctly instantiate final arrays. Remember that arrays are reference types, pointing to a block of memory, and remember that once an array has been marked as final, it can only be initialized once. Discover how to create and use final classes and final methods. Final classes cannot be extended. You will learn to recognize the implications of defining a class as abstract. Also, learn how to extend abstract classes and the implications of doing so. As the course concludes, you will discover that a class can only be instantiated if it has implemented all abstract methods.
Target Audience:
Duration: 01:01
Description:
In this course, you will learn about method overriding, including the use of the super keyword from contexts other than within constructions, and also examine the behavior of static methods. To start, participants learn how to apply method overriding and recognize the concept of hiding, and use the super keyword inside any method invocation in the derived class. This follows on to the use of advanced forms of overriding, combining method overriding with complex inheritance hierarchies. Study static methods and static binding, recognizing that static methods do not support run-time polymorphism. Examine pitfalls to avoid with static methods by learning to recognize how static methods are bound using compile-time rather than run-time binding. Learn how to correctly override the method .toString, which is inherited from java.lang.Object, and describe how the .equals method and the == operator are related. Explore how to correctly override the .hashCode method and write the code to correctly override the .equals method, inherited from java.lang.Object. Finally, after studying the link between equals and hashCode, discover how to implement the .hashCode contract.
Target Audience:
Duration: 01:23
Description:
In this 9-video course, you will learn about specific contrasts between run-time, compile-time polymorphism, and inheritance hierarchy in Java, including use of the Override annotation and type promotions in method overloading. Beginning with an introduction to polymorphism, you will examine run-time and compile-time polymorphism and recognize how run-time polymorphism works. In other tutorials, participants will look at the use of the @Override annotation, then look at how polymorphism works in the presence of a multilevel inheritance hierarchy, which leads on to discovering how easy it is to add a class into an inheritance hierarchy. You will then be introduced to the use of compile-time polymorphism and method overriding. To understand type promotion, you will begin to use compile-time polymorphism, including type promotions. In addition, you will learn how to recognize that compile-time polymorphism does not include type demotions. As the course concludes, you will learn how to use a combination of run-time and compile-time polymorphism.
Target Audience:
Duration: 01:22
Description:
In this course, learners will focus on creation of multilevel inheritance in Java and how such hierarchies include child and grand-child classes that all inherit from a common ancestor base class. Begin with an introduction to multilevel inheritance, and how you can access multiple derived classes by using a base class in multilevel inheritance. Explore use of the instanceof operator, where you can check that an object is an instance of every class in its inheritance hierarchy. Concerning the Is-A Relationship, you will learn how to apply multilevel inheritance when every object of the derived class is an object of the base class, but not every object of the base class is an object of the derived class. Examine downcasting; see how to upcast multiple levels; learn why downcasting is very dangerous; and perform various upcasting operations. After moving on to multilevel inheritance hierarchies, you will construct two parallel base classes and derived classes for each of those base classes. Finally, explore use of the extends keyword, recognizing situations where multiple inheritance is allowed.
Target Audience:
Duration: 00:57
Description:
In this course, you will learn the role of constructors and how to use the super keyword in architecting inheritance hierarchies in Java. You will begin by identifying the role of access modifiers and recognizing the basics of superclass constructors. When you add your own constructor, you will see that Java takes away the default no-argument constructor it had provided. You will learn how to apply the two ways of initializing derived classes: implement an explicit no argument constructor in the base class or use the super keyword and have only parameterized constructors in both the base and derived classes. You will recognize that a base class's constructor is invoked when a derived class object is instantiated and identify what happens when there is a base and derived class that have many different constructors. You will be able to initialize member variables: add a member variable into a derived class and ensure it is correctly initialized, even in addition to any invocations of the base class constructor.
Target Audience:
Duration: 00:59
Description:
In this course, you will explore the basics of inheritance and run-time polymorphism in Java, and how these concepts can be used to model Is-A relationships. Begin with an introduction to inheritance, and how to identify its advantages and applications. You will then apply inheritance to model real-world entities. Next, learn the concepts of polymorphism, its advantages and applications. Then move on to recognizing how the methods derived from java.lang.Object work, and also how all built-in Java classes possess the methods derived from java.lang.Object. You will examine how objects of derived classes have independent copies of member variables, even from the derived class. Following an introduction to the Is-A relationship, you will learn how to recognize, in single inheritance, that every object of the derived class is an object of the base class, but not every object of the base class is an object of the derived class. Explore how to upcast and downcast, and learn how downcasting can sometimes be dangerous. Finally, learn how one base class can be created with multiple derived classes.
Target Audience:
Duration: 01:23