Creating New Object of Other Class dynamicly ?

Posted by Meko on Stack Overflow See other posts from Stack Overflow or by Meko
Published on 2010-03-20T15:02:54Z Indexed on 2010/03/20 15:11 UTC
Read the original article Hit count: 176

Filed under:
|
|

I am trying to create new object of other class in a for loop. like

for(int i =0;i<10;i++){
 Computer  p1=new Computer(10,20);
}

and when I try anywhere to reach p1.someAction(); it say you must declare p1. But if I declare it on top of program how can I create again in loop? I also try only Computer p1; but it gave exeption ..

© Stack Overflow or respective owner

Related posts about game

Related posts about java