Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Stacks size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stacks size" Watch "Stacks size" New topic
Author

Stacks size

Rashid Ali
Ranch Hand

Joined: Jan 16, 2001
Posts: 349
Regarding stack, could anybody suggest me that how to do the following:
I give the size of stack from command line and i have to use this size so that an stack can automatically and increase when stack overflow occurs.
Thanks
Rashid
Lucas Richardson
Ranch Hand

Joined: Jul 08, 2001
Posts: 32
Someone please correct me if I'm wrong, as I haven't used stacks before, but my understanding of them was that they're growable and hence, in Java, it isn't possible to get a stack overflow. It automatically increases on it's own. (It extends Vector).
Rashid Ali
Ranch Hand

Joined: Jan 16, 2001
Posts: 349
Thanks for your answer. So it means that i don't need to set the size of stack whenever i want i can add the items in stack and it will automatically increase its length and there is no need to afraid of stack overflow.
But if i want to give its initial length so how could i give it in stack.
Please suggest.
Lucas Richardson
Ranch Hand

Joined: Jul 08, 2001
Posts: 32
There are various methods that allow you to play with the size. you can find the java API here: http://java.sun.com/j2se/1.3/docs/api/index.html.
The lower window on the left side lists every class in J2SE. Scroll down to stacks and it will show you all of it's methods and, more importantly (for what you want), those it inherits from Vector.
Paul Bailey
Ranch Hand

Joined: Oct 20, 2000
Posts: 91
You two are talking about different things. A Stack is an ADT that java implements in the class Stack. The Stack is where java stores all its objects. The Stack can overflow. Don't worry about it, it is mostly unrecoverable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stacks size
 
Similar Threads
Recursion
JVM - Memory Issues
Default Stack Size of Java ??
Would it be possible to write a servlet that output the current stack size?
Difference between Java Stack Size and Native Stack Size