Home arrow static arrow Java Programming [Archive] - list of My beans !
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - list of My beans !
This topic has 6 replies on 1 page.

Posts:172
Registered: 5/15/01
list of My beans !  
Aug 9, 2004 5:34 PM



 
Hi ,
I need to create list of mybeans..
i wanna create like this

MyBean[] mb ;

for (int i=0;i<5;i++){
mb = new MyBean();
mb.setData ("test");

}

for (int j=0; j<5;j++){
mb.getData();
}

Is it possible to do like this..If so , can u give me a solution...

thanks in advance,
bregoty

 

Posts:24,036
Registered: 2/3/03
Re: list of My beans !  
Aug 9, 2004 5:38 PM (reply 1 of 6)



 
Is it possible to do like this..If so , can u give me
a solution...

It looks like you've already done it. Are you having a specific problem?
 

Posts:172
Registered: 5/15/01
Re: list of My beans !  
Aug 9, 2004 8:08 PM (reply 2 of 6)



 
sorry ...i need like this

MyBean[] mb ;

for (int i=0;i<5;i++){
mb = new MyBean();
mb.setData ("test");

}

for (int j=0; j<5;j++){
mb.getData();
}

I need to create array of my beans..

thanks in advance,
balaji

 

Posts:172
Registered: 5/15/01
Re: list of My beans !  
Aug 9, 2004 8:09 PM (reply 3 of 6)



 
sorry ...i need like this

MyBean[] mb ;

for (int i=0;i<5;i++){
mb = new MyBean();
mb.setData ("test");

}

for (int j=0; j<5;j++){
mb.getData();
}

I need to create array of my beans..

thanks in advance,
balaji

 

Posts:24,036
Registered: 2/3/03
Re: list of My beans !  
Aug 9, 2004 8:22 PM (reply 4 of 6)



 
I know there's a question in there somewhere.

I'll try to ask very clearly.

hai balaji. u r having one doubt about some bean aray but looks like u already have like wat u need. try ur code and u will know.
 

Posts:24,036
Registered: 2/3/03
Re: list of My beans !  
Aug 9, 2004 8:25 PM (reply 5 of 6)



 
Sorry, that was rude.

I don't know if it's intentionally omitted or not, but you didn't initalize your reference.

MyBean[] mb = new MyBean[5] ; for (int i = 0; i < 5; i++) {    mb[i] = new MyBean();    mb[i].setData("test");} for (int i = 0; i < 5; i++) {    mb[i].getData();}
 

Posts:172
Registered: 5/15/01
Re: list of My beans !  
Aug 10, 2004 6:15 AM (reply 6 of 6)



 

Thank u very much.

-bregoty

 
This topic has 6 replies on 1 page.