Answers for "default constructor"

1

default constructor java

Default constructor is a constructor created by compiler; if user does not 
create a constructor in a class.
If user defines a constructor in a class then java compiler will not create 
default constructor.
Posted by: Guest on October-23-2020
0

default constructor

public class Vehicle {
  protected String vin;
  protected int modelYear;
  
  public Vehicle() { } 
  
  public Vehicle(String vin) { 
    this.vin = vin;
  }
   
  public Vehicle(String vin, int modelYear) { 
    this.vin = vin;
    this.modelYear = modelYear;
  }
}
Posted by: Guest on April-28-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language