how to create a new object in java code example
Example 1: java create new object
Car mycar = new Car();
Example 2: create instance object java
myCar = new Car();
Example 3: make an object in java
public class Puppy {
public Puppy(String name) {
// This constructor has one parameter, name.
System.out.println("Passed Name is :" + name );
}
public static void main(String []args) {
// Following statement would create an object myPuppy
Puppy myPuppy = new Puppy( "tommy" );
}
}