[go: up one dir, main page]

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

Lecture 07

Uploaded by

shayansarker07
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 views10 pages

Lecture 07

Uploaded by

shayansarker07
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
You are on page 1/ 10

That's All!

1
Dynamic Method Dispatch

The call to an overridden method is


resolved at runtime rather than
compile-time. It is also known as
runtime polymorphism.
2
Abstract Class

An abstract class in Java is a class that cannot be


instantiated on its own and is meant to be
subclassed. It may or may not include abstract
methods, which are methods declared without an
implementation. It is used when you want to create a
base class that provides some default behavior while
enforcing that certain methods must be
implemented by subclasses.
3
‘Final’ Inheritance?

Final Variable: A final variable can


only be assigned once. If it is a
reference type, the reference cannot
be changed, but the object it refers to
can still be modified.

4
Garbage Collection
Garbage Collection is process of reclaiming the runtime unused memory
automatically. In other words, it is a way to destroy the unused objects.

To do so, we were using free() function in C language and delete() in C++. But, in
java it is performed automatically. So, java provides better memory management.

Advantage of Garbage Collection

○ It makes java memory efficient because garbage collector removes the


unreferenced objects from heap memory.
○ It is automatically done by the garbage collector(a part of JVM) so we don't
need to make extra efforts.
5
Garbage Collection - The finalize( ) Method
○ Sometimes an object will need to perform some action when it is destroyed.
○ For example, if an object is holding some non-Java resource such as a file
handle or character font, then you might want to make sure these resources
are freed before an object is destroyed.
○ To add a finalizer to a class, you simply define the finalize( ) method. The Java
run time calls that method whenever it is about to recycle an object of that
class

6
Garbage Collection

7
8
9
Goodbye! It’s been wonderful

Md. Tariquzzaman (TZF)

Signing off!

10

You might also like