Standards, Specific Operators, Class and Object (OOP - JAVA)

OBJECT ORIENTED PROGRAMMING CONCEPTS IN JAVA

Class Hierarchy

1.Object

2.Class

3.Method

4.Variable

STANDARDS         


We use some standards to write java codes 😇

                 class Java {

                      String str;

                      public void test() {

                 }

                 }

  • We use simple letter to start variable names. We use camel case to write variable names. (yellow)
  • We use capital letters to start class names. We use mixed case to write class names. (purple)
  • We use simple letters to start method names. We use camel case to write method names. (blue)
eg: Duneth - class
      duneth() - method
      duneth - variable

Java print statement

System.out.print("Hello world");

System - class
out - variable
print() - method
; - semi colon which is used to end a particular statement
. - dot operator which is used to calling

Consider Following Structure,

class A {
    String a = "1";
    System.out.print(A.a);
    public void test() {

    }
}


blue color curly brackets are indicating method scope.
red color curly brackets are indicating class scope. 


ASSIGNMENTAL OPERATOR AND EQUALIZATION OPERATOR


Assignmental Operator is used to assign a value for a particular variable. 
Equalization Operator is used to equal a value for a particular variable.

Assignmental Operator -             String b = "abcd";
                                                       b = "efgh";

Equalization Operator -              String c == "abcd";


CLASS AND OBJECT 🤔


OBJECT

The man has head, hands, eyes, nose, legs, chest, mouth, ears etc. These are the  properties of a man.

As well as he can perform some activities such as walk, jump, eat, write, smile etc. These are the behaviors of a man.

We can say an object for a particular thing which has properties and behaviours, 

for an example a vehicle has wheels, engine, doors, roof, seats etc. as well as it can accelerate, break, rotate wheels etc. So, we can say vehicle is an object.

CLASS

Properties and behaviours that are relevant for a particular object, we called in programming,

Class as object
Properties as variables
Behaviours as methods

We use variables and methods inside the class as same as properties and behaviors are inside the object. So, a class is a template which are created relevant for a object. we can make some objects by changing values inside a class.

Human (object) >> class
Hands, Legs, Head (properties) >> variables
Walk, Jump, Run (behaviours) >> methods






                

Comments

Popular posts from this blog

Object Creation, Data Types (OOP - JAVA)

Upcasting and Downcasting (OOP - JAVA)

Method Overloading (OOP - JAVA)