Constructor
public Vehicle () {
maxLoad=14.5;
}
// default constructor
public Vehicle ()
{
}
public Vehicle (int a, int b)
{
//////
}
Call method form main method
Vehicle x= new Vehicle ( );
x.setMaxLoad(14.5);
Question1: According to Syntax in above, specify class name and its modifier?Question1: According to Syntax in above, specify class name and its modifier?
class name is Vehicle
Modifier is the keyword public which is accessible by any other class
Comments
Leave a comment