In this lecture we will learn:
– Java is an object-oriented language
– What are objects?
– What are classes?
– How do classes and objects create?
#1
Java is Object- Oriented Programming:-
– In the real world, everything is an object like a pen, mouse, glass, etc.
– Every object has two things:
– An object knows something ( It has some properties)
– An object does something( It has a behaviour)
– Every object has a property and behaviour. It can also have multiple properties as well as multiple behaviours.
– To create an object, first, we need to create a class.
– Class act as a blueprint that contains the designing of an object.
#2
– JVM creates objects in Java.
– JVM creates an object but it requires a blueprint.
– Thus, you create a class file that class file gets compiled to create a byte code and that byte code goes to the JVM and then JVM creates an object.