0% found this document useful (0 votes)
6 views17 pages

Java Final Variables and Inheritance Explained

this is docs about OOP subject

Uploaded by

Thu Hà Phan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views17 pages

Java Final Variables and Inheritance Explained

this is docs about OOP subject

Uploaded by

Thu Hà Phan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

cannot assign a value to final variable z

multi-inheritance
only support for single-inheritance

can ignore or JVM can resolve

cannot construct will have default value


--> ex: int - default value = 0
boolean - default value = false

parent class has attributes with different modifier: private < default < protected < public
--> private : not inherited
// not inherited
2 independent class (not inheritance) with many overloading methods
--> output is int not double so no need downcasting
assign parent Person to child manage --> upcasting
private < default < protected < public
parent class Person :
+ 2 attributes with protected modifiers
+ 2 constructors: default + 2 parameters passed constructor
--> still inherit all attributes + methods

child class Employee extends from Person class


--> Override 2 constructors
parent class A has method with default modifier

child class B extends from class A --> Overloading methods

child class C extends parent class B --> Overloading method

1. --> access to method C : myMethod("CHECK", 68.34)


2. --> access to method B: myMethod() --> "CHECK68.34" --> return String
3. --> access to method A: mymethod() --> CHECK68.34CHECK68.34
--> return String
interface 1: with interface method1
interface 2:; with interface method2
implement interface body 2

implement interface body 1

not construct instance about interface

You might also like