#CoreJava/ObjectOrientedProgramming

Programming Language
Use the syntax perfectly
Programming Language for machine understanding

Machine understand the programming language.png

Machine Advantages:

Machine Disadvantages:


Procedural vs Object Oriented Programming

What is OOPs?

?

OOPs Features

?
The key features of OOPs (Object-Oriented Programming) are:

  1. Encapsulation: Bundling data and methods together, and restricting direct access to some of the object’s components.
  2. Inheritance: One class can inherit properties and behaviors from another class.
  3. Polymorphism: Objects can take many forms, allowing methods to be used in different ways.
  4. Abstraction: Hiding complex details and showing only the essential features.
Object

Identity - Hashcode (Hashcode is generated using a hashing algorithm)
Instance - எடுத்துக்காட்டு
Instantiation means object creation.
Attributes - State

Both tangible and intangible objects are possible.
An example of a tangible object is the laptop.
An example of an intangible object is the banking system.
Tangible - உறுதியான (உணரமுடியும் )
Intangible - உணரமுடியாத

Creation of Object Syntax

?

class_name object_name = new class_name();

Explanation: we are using the new keyword to create the object of the class class_name, we can also observe, how the constructor of the class is been called using the new keyword.

new - allocates memory for object inside of the class. It is dynamic memory size.
class_name() - இந்த Brackets இல்லாம object create செய்யமுடியாது. இந்த Brackets constructor உடன் தொடர்புடயவை.

new class_name() --> Object
object_name --> Object Reference

Example:

MobileShop samsungMobile = new MobileShop();
What is Object?

?

What are the Characteristics of Object?

?
An object has three characteristics:

How many types to create an objects in java?

?
There are several ways of creating an objects in java, they are:

1. new keyword
  1. newInstance() method of Class class
  2. newInstance() method of Constructor class
  3. clone() method
  4. Deserialization in Java
  5. Factory Method Pattern
Is it possible to run a Java program without creating an object? How does it work if all methods are static?

?

public class Example {
    // Static method
    static void displayMessage() {
        System.out.println("Hello, World!");
    }

    // Main method (also static)
    public static void main(String[] args) {
        // Call static method without creating an object
        displayMessage();
    }
}

What is Class?

?

Syntax of Class

?

class ClassName{
	//attributes (Objects)
	//methods
}

Explanation:

Member Functions
?
The functions are written inside a class are known as member functions.

Instance variables
?
Variables that are declared within the scope of the class.

Give any 5 Classes in java

?

Structure of a Java Project

Follow this order: