Code:
public static void main( String[] args )
{
// Create 1 Bicycle reference variable
Bicycle bike;
// Create 1 String reference variable for the owner's name
String name;
// Create 1 integer variable for the license number
int number;
// Assign your full name and a license number to the String and
// integer variables
/* WRONG WRONG WRONG
bike.setownerName = "Josh";
bike.setlicenseNumber = 12345;
Those are *NOT* the String and integer variables you just declared!!
Technically, they aren't variables at all. They are object properties.
*/
name = "Josh"; // Assign your full name...to the String...variable
number = 12345; // Assign you...license number to the...integer variable
// Create a Bicycle object with the Bicycle constructor
// Use the variables you created as arguments to the constructor
bike = new Bicycle( name, number ); // just *EXACTLY* as required
...
The *ONLY* way to
create an object in Java is via the
new operator. Period.
And yes, you could have done
Code:
bike = new Bicycle( ); // create an empty Bicycle object
bike.setownerName = name; // fill in the two fields
bike.setlicenseNumber = number;
but (1) that doesn't do what you were asked to do and (2) if the empty ("default") constructor for Bicycle is private, you wouldn't be able to create the empty object in the first place.
Does that help at all?