Bookmark Topic Watch Topic
  • New Topic

plz help me out in stacks  RSS feed

 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Report post to moderator
how to create araays of stack()?

e.g:
if i declare

Stack[] st=new Stack[100];
then if want to store values of stacks not by using push method only by stack adding, how to do that?

see below:
for(int i=0;i<100;i++){
st[i]=(stack type) i; // how to do this?
}
System.out.println(st.size());
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
You are declaring an array of 100 Stacks, but you'll have to declare new objects for each elements. So in your loop, you will have to use something like "Stack s = new Stack()" and put it in the array.
I'll let you figure out the rest.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question multiple times. If you get an answer you don't like, then provide followup information in the same thread. here is the first time you asked about this. I'm closing this later thread.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!