What is Class & Objects In JAVA || Class and Objects in oops


Classes and Objects In Java


📝What is 'Class' in Java? :

  • A Class is a Logical entity or Blueprint using which we can create multiple Objects
  • We cannot create an Object without a Class. Hence Step.1 create a class and then create any number of objects
  • Multiple Objects created using the same class are called as Similar Object or Identical Object. 
  • Every Object work independently, I.e.., if one Object is modified or destroyed then it does not affect another Object. 

📝What is 'Object' in java? : 

  • An object is a Real-world Physical entity. 
  • Anything which has Physical presence or Physical appearance can be considered as an Object.
class and object in java

    🌟Object Contains two Important things Or Properties:-

    1. States
    2. Behavior
    • After successful compilation, the compiler generates default Constructor. Where the constructor name must be the same as a class name
    Example
    class and object in java, object class in java, classes and objects in java example programs, instance of a class in java, java class attributes, java and python classes, immutable class in java, simple java class, java data class, basic java class
      🎖Some Important Points Of Object:-
      • In java, Objects are stored in Heap Memory. Memory allocation & Memory deallocation i.e, complete Memory management is taken care by JVM
      • Jvm creates an object in heap Memory when we call the Constructor using a "new" Keyword. 
      • Object address is represented in Hexa Decimal format. 
      • The Class name and object name must be the same.
      • This address is started in a variable called a reference variable, which helps in accessing the data present in the Object.
      Best telegram channel of shopping offers?

      🎖How To Create Object in java, and how it's Stored In Memory:-

      Example(1):   
      object class in java
      Example(2):   
      object class in java

      🌟Object Reference / Object Address : 

      • A Reference is the one which stores an Object address, Hence Object Reference is present in Heap Memory
      Example: 
      class and object in java

      🌟what Are the States of an object

      • The State of an object is nothing but the property/information or data which describes an Object.
      • The data member is nothing but a data holder, which holds / stores the data. 
       States:- It is always representing features of an Object.
      type of a mobile, price of a mobile, color of a mobile, variable
      Behavior:- It always represents the Action performed by an Object.
      type of a mobile, price of a mobile, color of a mobile, variable
      📎There are 2 types of Data Member: 
      ➢ Variable.
      ➢ Constant.
      • In the case of Variable, the data Varies I.e.., the data Changes
      • Programmatically non-final data members are called Variable
      • Constant is the data member which represents Fixed Value
      • Programmatically we declare Constant using Final Keyword.
      Example: 
      final name = “Dog” ;  →  Constant
      name = “ Tommy” ;  → Variable
      Since an Object is derived from a class, the States & Behaviors of an Object must be first declared in class, Hence States & Behaviors are contents of the class. 
      Example:  
      class and object in java, object class in java, classes and objects in java example programs, instance of a class in java, java class attributes, java and python classes, immutable class in java, simple java class, java data class, basic java class
      Object Creation & Direct Initialization:
      class and object in java, object class in java, classes and objects in java example programs, instance of a class in java, java class attributes, java and python classes, immutable class in java, simple java class, java data class, basic java class
      ➢Object Creation & Initialization using Object Reference 
      class and object in java, object class in java, classes and objects in java example programs, instance of a class in java, java class attributes, java and python classes, immutable class in java, simple java class, java data class, basic java class