Recent Posts
None | 0 sec ago
HTML | 10 sec ago
mIRC | 39 sec ago
None | 49 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
HTML | 1 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Anonymous on the 9th of Feb 2010 08:06:11 PM
Download |
Raw |
Embed |
Report
{
/** Decleration of variables */
private int Id = 0; // the unique id for the instance of the class
static int counter = 0; // the counter of how many classes made
static List classList
= new List(); // creates new list to store all the class instances
private double coord_x, coord_y;
/**
Description: This constructor will run when new instance of this class is
created and no values for x and u are specified
*/
{
this(0.0,0.0);
}
/**
Description: This constructor will run when new instance of this class is
created and gets specified values for x and y
@param x (double), the value of x coordinate
@param y (double), the value of y coordinate
*/
public Point(double x,
double y
)
{
this.coord_x = x;
this.coord_y = y;
classList.set(this.Id,this); // this is what i am trying to get to work
this.Id = this.counter++;
}
}
// i am trying to keep track of all classes so i can have a method within this class that will print all my x, y and the Id of the class
// My idea was to add the refrence of the class to a list and then use for loop to print them all out.
//Error
Point.
java:47
: cannot find symbol
symbol : variable This
classList.set(this.Id,this);
// ahh this is wrong error i got but it does not work for the code above
^
1 error
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post