ClassName objectName = new ClassName();
Car mycar = new Car();
public class Multiplication{
public static void main(String[] args){
Multiplication multi = new Multiplication();//Object creation
}
}
class Fruit
{
public static void main(String args[])
{
function nameFruit()
{
System.out.println("Orange");
}
}
}
Fruit f = new Fruit(); //make object of fruit
f.nameFruit();
className object = new className();
// for Bicycle class
Bicycle sportsBicycle = new Bicycle();
Bicycle touringBicycle = new Bicycle();
Objects: came from class, we can create multiple objects from a class
ArrayList<> list = new ArrayList<>();
Class refName OBJECT
each object has its own copy of instance variable
· declared outside the blocks or methods
Object: Instance of the class. We can store different data's to objects
Object Creation: with new keyword.
ClassName obj = new ExistingConstructor;
SinifAdi sinifAdi = new SinifAdi();