Re: Creating an object...
You have to write the Squares class. Programming does not happen by magic. Also be careful of how you name your classes. Squares suggest it will hold information about many squares. Whereas Square suggests that it will hold information about a single square.
Re: Creating an object...
Okay I am already lost, mind pointing me in the right direction for making the class?
Re: Creating an object...
Code java:
Squares squares = new Squares();
Where is that line of code? I assume it is in a main method inside a class you have written. So you already know how to write a class.
Re: Creating an object...
Hi RodePope4546,
the syntax you are using to create the object is correct. You just need to make sure the code to use Squares class have access to Squares class. I mean, the class which have following code,
Squares squares = new Squares();
should either be in the same package or have import the package which contains the Squares class.
Hope this will resolve the issue!
Re: Creating an object...
write Squares class according to your program and make sure it is visible to class in which statement Squares squares = new Squares(); is written as suggested by java_I3.
Re: Creating an object...
Quote:
direction for making the class?
A class is defined by the class keyword.
class MySquares {
... here define the stuff for the class
} // end class definition