Nested Switch statement in an If statement
Posted on 2001-07-26
Hello...new java programmer here...with what i am sure is a simple question.
here is my code:
for(int i=0; i < shapes.length; i++)
int x = (int)((Math.random()*2) + 1);
pt1 = new Point((int)(Math.random()*maxPt), (int)(Math.random()*maxPt));
pt2 = new Point((int)(Math.random()*maxPt), (int)(Math.random()*maxPt));
shapes[i] = new Line(pt1, pt2);
shapes[i] = new Circle(pt1, ((int)(Math.random()*maxRd)));
OK...so when i print out the results it looks like it runs through the 3 statements above the switch statment before it enters the switch statement. I dont understand why. I was expecting it to go through each line including the switch statement and then return to the first line again and complete the loop...What is it that i dont understand about this?