Core Java Development Course for Beginners - Part 6 - Object Oriented Programming (OOP)

Udayan Khattry, SCJP, SCWCD & Oracle Database SQL Certif

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
40 Videos (8h 8m)
    • Classes and Objects

    • Constructors 1

    • Constructors 2

    • Stack and Heap 1

    • Stack and Heap 2

    • Methods 1

    • Methods 2

    • Methods 3

    • Methods 4

    • Methods 5

    • Methods 6

    • Variables 1

    • Variables 2

    • Variable Shadowing 1

    • Variable Shadowing 2

    • Initialization Blocks 1

    • Initialization Blocks 2

    • Garbage Collection

    • Encapsulation

    • Access Modifiers

    • Inheritance 1

    • Inheritance 2

    • Inheritance 3

    • Inheritance 4

    • Inheritance 5

    • Inheritance 6

    • Inheritance 7

    • Polymorphism 1

    • Polymorphism 2

    • Reference Type Method Overloading

    • equals method

    • Overriding Rules

    • Primitive Array Vs Reference Array

    • abstract keyword 1

    • abstract keyword 2

    • when abstract class is not enough

    • interface in Java 1

    • interface in Java 2

    • Interfaces in JDK8

    • Association and Abstraction


About This Class


This course is for anyone who wants to learn Java from scratch, polish java skills, face java interviews and prepare for java certifications.

Anyone can take this course and go from 0 developments skills to being expert in OOPs and core Java.
Java is the most popular language world wide and technologies like Servlets & JSP, J2EE, Struts, Spring, Hibernate, JMS or android for mobile applications are all based on core Java.
Even Kotlin (android's new programming language) becomes easier if you know Java.

Having a sound understanding of core java concepts is necessary, if you want to learn advance concepts, frameworks and android programming.

Following Lectures are covered in Part-6

1.            Classes and Objects

In this lecture you will learn:

  • What is OOP?
  • What are objects?
  • What are states/properties and behaviours of objects?
  • Some examples of real world objects.
  • What is Class and how to create a class template based on similar objects?
  • How to convert class's blueprint to Java Code?
  • How to create objects in Java using new keyword?
  • How to read/write properties of Java objects?
  • How to invoke methods on Java objects?
  • Best Practice: Separation of core business logic and Object creation or testing.

2.            Constructors

In this lecture you will learn:

  • What comes first: Class or Object?
  • What are constructors and how constructors are invoked?
  • What is a default constructor?
  • Syntax of default constructor.
  • default values are assigned to instance variables.
  • Syntax of parameterized constructor.
  • Code to invoke various constructors.
  • Difference between parameters and arguments.
  • No-argument constructor.
  • What is the scenario in which default constructor is not provided by Java compiler?
  • this(); calls no-argument constructor from parameterized constructor.
  • this(...) with argument(s) calls parameterized constructors.
  • Call to this(...); should be the first statement inside parameterized constructor.
  • Assigning values to instance variables at the time of declaration.
  • What is constructor overloading?
  • How to copy and paste whole packages (containing files) in Eclipse IDE?
  • Usage of Ctrl + O to get the list of all the methods and constructors of a class in Eclipse IDE.

In this lecture you will learn:

  • STACK and HEAP memory areas.
  • What goes in HEAP and what goes in STACK?
  • Implicit variable "this" available to all the instance methods and constructors of the class.
  • Variable "this" is not accessible to static methods.
  • Difference between this() and this.
  • PUSH and POP terms related to STACK.
  • Validate the STACK and HEAP concepts covered in previous lecture using Debug mode.
  • Expressions and display view available in debug mode.
  • Content assist feature of display view.


4.            Methods

In this lecture you will learn:

  • What are methods?
  • Syntax for method declaration.
  • A method can return primitive type or reference type.
  • Use of return keyword to return the value from the method.
  • Use of keyword void in method declaration, if method doesn't return any value.
  • A method can accept 0 or more parameters.
  • Method types: instance method and static method.
  • Syntax to invoke instance and static methods.
  • Type instance(non-static) and static methods in Eclipse IDE.
  • Decide on the method name, its parameters and return type.
  • Provide test codes for the methods.
  • Content-assist feature of Eclipse IDE shows the list of all the instance/static variables and methods, so you can select, instead of typing the method/property name.
  • How to decide whether method should be static or non-static?
  • Correct way to call static methods.
  • Method declaration and Method signature.
  • One java file can have multiple classes declared in it, but only one class with public access specifier.
  • NullPointerException and why it is thrown.
  • How to handle NullPointerException?
  • How to call a method from another method of the same class?
  • instance methods can invoke both static and instance methods.
  • static methods can only invoke static methods.
  • Example on moving duplicate codes to a method.
  • Eclipse shortcut to correct all the variable names at once.
  • STACK and HEAP memories during method invocation.
  • pass-by-value and pass-by-reference schemes.
  • More scenarios on pass-by-value and pass-by-reference schemes.

5.            Variables

In this lecture you will learn:

  • Need for static / class variables.
  • How java runtime handles static / class variables?
  • When are static variables initialized?
  • Syntax to access static variable.
  • LOCAL variable.
  • Types of variables: "class or static variables", "instance variables" and "local or automatic variables".
  • Scope of the variables.
  • Lifetime of the variables.
  • Usage of curly brackets within method body to shorten the scope of the variable.

6.            Variable Shadowing

In this lecture you will learn:

  • Not possible to have multiple variables of same name and type(static or instance or local) in the same scope.
  • What is variable shadowing?
  • Shadowing of static variables in detail.
  • Full name and short hand notation of static variables.
  • Shadowing of instance variables in detail.
  • Full name and short hand notation of instance variables.
  • Eclipse IDE uses "L" icon to denote local variables in debug mode.
  • How to generate constructor code (not type) in Eclipse IDE?
  • Local variables are not initialized to default values.
  • Local variables needs to be assigned with some values before they can be used.

7.            Initialization Blocks

In this lecture you will learn:

  • static initialization block, its syntax and why it is needed.
  • instance initialization block, its syntax and why it is needed.
  • Code area within class boundary but outside methods and constructors is for declaration statements and not for other code statements.
  • How Java runtime handles static and instance initialization blocks?
  • What is watch-point in Eclipse debugging and its significance?
  • Display view of Eclipse debugging.
  • static initialization block throws ExceptionInInitializerError instead of actual Exception object.

8.            Garbage Collection

In this lecture you will learn:

  • Meaning of unreachable objects.
  • What is garbage collection?
  • getRuntime().gc() and System.gc() calls.
  • Why java.lang.StackOverFlowError and java.lang.OutOfMemoryError are thrown?

9.            Encapsulation

In this lecture you will learn:

  • Why it is a bad idea to declare instance variables with public access modifier?
  • Meaning of "private" access modifier.
  • What is Encapsulation?
  • What are getter and setter?
  • How to generate getter and setter codes using Eclipse IDE?

10.       Access Modifiers

In this lecture you will learn:

  • Which access modifiers can be applied to outer java classes and their effects on the classes?
  • Which access modifiers can be used with members (Instance/static variables, constructors and methods) and their effects on the members?
  • Usage of Eclipse IDE shortcut "Ctrl + Shift + O" to add import statements for all the used classes.

11.       Inheritance

In this lecture you will learn:

  • What is inheritance and related Java syntax?
  • Class diagram of UML.
  • Meaning of +, #, ~ and - signs in class diagram.
  • extends keyword.
  • How Java runtime creates instance of a class inheriting from another class?
  • Various terminologies associated with inheritance.
  • Derived/Sub/Child class can have its own set of properties and methods.
  • How to override a method in Derived class?
  • How java runtime handles method overriding scenario?
  • Overridden method and Overriding method.
  • @Override annotation.
  • Invoke Parent class's method (from Child class) using super keyword.
  • All accessible instance variables of a class are inherited by sub class.
  • All accessible instance variables cannot be overridden by sub class.
  • Sub class hides the super class's instance variables.
  • How to access the instance variable of Super class by using super keyword?
  • Similar to instance variables, static fields and static methods of a class are also not overridden.
  • Constructors, initialization blocks and their order of execution in case of Inheritance.
  • Syntax of the default constructor added by compiler in case of Inheritance.
  • 1st statement inside every construtor should either call other overloaded constructors using this(...) or parent class constructor using super(...).
  • Compiler by default adds a call to super(); no-arg constructor of parent class.
  • What is constructor chaining?
  • Constructors and never overridden but they are chained.
  • lang.Object class.
  • Why System.out.println() method behaves differently when String type reference variable is passed?
  • toString() method of Object class and need to override it.
  • What are Multilevel Inheritance and Hierarchical Inheritance?
  • Deadly Diamond of Death problem in Java.
  • Working of Ctrl + T keys in Eclipse IDE.
  • Details of protected modifier.
  • difference between default and protected modifiers.
  • Usage of final modifier with methods.
  • Usage of final modifier with classes.
  • Some of the final classes in Java API.
  • Allowed modifiers for local variables.
  • Usage of inheritance concepts in real world, with example.
  • When to extend from a class and when to avoid inheritance?
  • What are the benefits of inheritance?

12.       Polymorphism

In this lecture you will learn:

  • Polymorphism and its types.
  • What is static polymorphism?
  • What are Operator overloading, Constructor overloading and Method overloading?
  • Method overloading rules.
  • What is dynamic polymorphism?
  • What are the limitations of dynamic polymorphism?
  • Explicit casting of reference type, its syntax and risks involved with it.
  • Why ClassCastException is thrown at runtime?
  • How to avoid ClassCastException using instanceof operator?
  • Explicit casting and instanceof check are not possible between siblings or unrelated classes.

13.       Reference Type Method overloading

In this lecture you will learn:

  • How overloaded methods accepting reference type parameters are invoked?
  • IS-A or IS-AN relationship.

14.       equals() method of Object class

In this lecture you will learn:

  • Why it is needed to override equals(Object) method of Object class?
  • How to override equals(Object) method in your classes to compare two instances?

15.       Overriding Rules

In this lecture you will learn:

  • The rules of method overriding.
  • What is covariant return?
  • Why overriding method cannot use more restrictive access modifiers?

16.       Primitive Array vs Reference Array

In this lecture you will learn:

  • The difference between Primitive type and Reference type arrays.

17.       abstract keyword

In this lecture you will learn:

  • Why abstract methods are needed in Java?
  • Syntax of abstract methods and abstract classes.
  • abstract classes cannot be instantiated.
  • What is Implementing method?
  • Use of @Override annotation with implementing method.
  • Why to declare a method with final modifier?
  • Is it possible to have an abstract class without abstract methods?
  • Who invokes the constructor of abstract class?
  • Why new A(); gives compilation error whereas new A[5]; is allowed, where A is an abstract class?
  • Rules related to implementing methods.
  • Access modifiers used with abstract methods.
  • Why following modifier combinations are not allowed: abstract and private, abstract and final, abstract and static?

18.       When abstract class is not enough

In this lecture you will learn:

  • It is not always possible to provide clean solutions using abstract classes only, we will see one such example.
  • It is advisable to use super class reference variable to refer to the sub class's instance.

19.       interface in Java

In this lecture you will learn:

  • What are core and sideline features and how to implement these?
  • What is an interface and how to define it?
  • How to implement an interface?
  • "interface" and "implements" keywords.
  • Interface reference type variable referring to the instance of implementing class.
  • How the use of interfaces with abstract classes can provide clean solution rather than using abstract classes only?
  • How to implement multiple interfaces?







Reviews (0)

Udayan Khattry

SCJP, SCWCD & Oracle Database SQL Certif

Hi, I'm Udayan. I have a master's degree in Computer Applications from Symbiosis International University, Pune, India and have completed following professional certifications:
- SCJP 1.6 (Sun Certified Programmer for J2SE 6.0)
- SCWCD 1.5 (Sun Certified Web Component Developer)
- Oracle Database SQL Certified Expert

After working as a software developer and consultant for over 9 years for various companies in India, Dubai & Singapore, I decided to follow my lifelong passion ...

See full profile