This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Stack Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Stack" Watch "Stack" New topic
Author

Stack

nani aman
Ranch Hand

Joined: Sep 22, 2004
Posts: 33
My friend suggest to use stack(pop and push concept) in my program and i surf for it and found it is in java.lang.Object. The push method declare as push(Object item). Actually i want to push a string into the stack. But in this method, it used object type as an item. Is is string can be known as object? And how to implement in. The normal java program as declare, define and create is in stack, we do the same way. How?

I really want to understand the flow of concpet in stack rather than use array to save a few string.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

A String IS an Object, so you can pass it to the method that accepts Object argument.

As for learning about Stacks here you go -
Data+Structures+Stack

and here is alink to Java Collections class Stack documentation -
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Stack.html


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
In chapter 11 of David J. Eck's Introduction to Programming Using Java is a pretty good explanation of Stacks (and other data structures).

I seem to recall that Bruno Preiss' free on-line book, Data Structures and Algorithms with Object-Oriented Design Patterns in Java, was worth reading, as well.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
I used Data Structures and Algorithm Analysis in Java of Mark Allen Weiss, when I was in the university... It got a second edition in 2002 as well... The book is really easy to understand Data Structures; including Stack, Queue and other ADTs...

I rate it as 9 out of 10 horseshoes...

Hope it helps...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stack
 
Similar Threads
Still Stacks
Interfaces and polymorphism design questions - I would appreciate some input
stacks
plz help me out in stacks
itemAt Stacks