Ok so what I am trying to do here is create an array of 10 squares pretty much, However it seems to be makgin an array of 100 objects 10 of each square. I feel thintk that i am missing something simple here can someone help point me in the correct direction thanks in advance guys
/**
* Created with IntelliJ IDEA.
* User: Joe
* Date: 1/18/13
* Time: 1:56 PM
* To change this template use File | Settings | File Templates.
*/
import java.math.*;
import java.util.*;
public class Square {
private int length;
private int width;
private int area;
Random randomgenerator = new Random();
public Square(){
length= randomgenerator.nextInt(20);
width= randomgenerator.nextInt(20);
}
public void CalcArea(){
area = length*width;
}
public double getLength(){return length;}
public double getWidth(){return width;}
public double getArea(){return area;}
public static void main(String[] args){
Square[] set = new Square[10];
for(int i=0;i<10;i++){
set[i] = new Square();
for(int j=0;j<10;j++){
System.out.println(set[i].getLength());
}
}
}
}