Object creation
public class Calculator { public static void main(String[] args) { Calculator casio = new Calculator(); //Constructor } public void add() { System.out.println(10+20); } } In java, we have a keyword called "new" which should be followed by class name. Class name should start with capital letter. new Calculator; Here, an object is created and then we have to give name. calculator casio = new Calculator; //constructor Here casio is object's name. calculator casio - object's representation. new Calculator - object creation. Structure of object creation: Classname reference_name = new Classname; What is a method? A method is a block of code that performs a specific task and can be called for execution by its name. public void add() If it contains () it is definitely a method. main(String[] args) - main method add() - add method

public class Calculator
{
public static void main(String[] args)
{
Calculator casio = new Calculator(); //Constructor
}
public void add()
{
System.out.println(10+20);
}
}
In java, we have a keyword called "new" which should be followed by class name.
Class name should start with capital letter.
new Calculator;
Here, an object is created and then we have to give name.
calculator casio = new Calculator; //constructor
Here casio is object's name.
calculator casio - object's representation.
new Calculator - object creation.
Structure of object creation:
Classname reference_name = new Classname;
What is a method?
A method is a block of code that performs a specific task and can be called for execution by its name.
public void add()
If it contains () it is definitely a method.
main(String[] args) - main method
add() - add method