This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object on stack

 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to put an object on stack in java?
Rgds,
Seetesh
 
Annekee Dufour
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why would you want to do that?
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just checking out the possiblity if its possible?
Seetesh
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was trying something like this
String language = "english";
String country = "english";
int a = 100;
int b= 100;
Stack astack = new Stack();
astack.push(language);
Stacks dont seem to take in int values.
Any clues.
Seetesh
 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, they only hold Objects. In order to push ints or other built-in types onto a stack, you need to use the wrapper classes such as Integer. You should learn as much as you can about the wrapper classes. They are used quite frequently. I'm sure you can search the board for previous discussions about them.
Layne
 
Annekee Dufour
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aha, you mean a Stack and not the stack as in stack vs. heap!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic