Bicyle bike1 = new Bicycle() is correct and would work as long as you
have Bicycle.java class and you have JDK in classpath on your machine.
Bicycle
as you have mentioned is a java class and with that line, you are attempting to create an object (an instance with reference name: bike1
) of the class. In this particular class (Bicycle) constructor arguments are not required.
Refer to the basics from Oracle Java Docs on this site, there is explanation of how to create objects and how to use them, this particular link also has instruction on creating objects with constructor arguments.
The best way is to learn the basics from the Oracle/Java tutorial pages. Here is the link for that.
1
solved Could somebody explain this: thing variable= new thing();? [closed]