Salesforce Basics

What is an Object in Java?

The object simply means a real word entity such as CAR, BUS, PEN etc.  Or the technical entity that has state and behavior is known as an object.


Example: Let’s consider a CAR as an Object. The car has color, Model, Engine type as state and Starting, Running, mileage can be considered as behaviors.

So in software cycle, each Object has its own variables which can be considered as STATE and purpose of using it in coding can be considered as behavior.


What Is a Class?

The class is a blue print of an individual Object or Collection of objects, for example, We will go with CAR as an Object and we will build blue print that is a Class called CAR. Color, Model, Key can be considered as State of CAR Object and engineStart, engineStop, applyBrakes can be considered as behaviors of CAR.



Class CAR {

                        String Color = ‘red’;

                        String Model = ‘Swift ZDI’;

                                    String Key = ‘Start Button’


Void engineStart(){

                        //code to start the engine


Void engineStop(){

                        //code to stop the engine


Void applyBrakes(){

                        //code to apply Brakes