File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Confused with System.out.print Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Confused with System.out.print" Watch "Confused with System.out.print" New topic
Author

Confused with System.out.print

srinivas srinivasmeenavalli
Ranch Hand

Joined: Jul 13, 2008
Posts: 65




stack.size()=5
Values are in stack = 12
Values are in stack = 23.6755
Values are in stack = Srinivas
Values are in stack = A
i=4
Employee =Srinivas : 163052 Employee =Srinivas : 163052


Employee out values are coming twice.Any one has idea why it's coming twice ?
when i give println everything is working fine .
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
I ran your code and obtained this output
campbell@********-laptop:~/java$ java JavaStackExample
stack.size()=5
Values are in stack = 12
Values are in stack = 23.6755
Values are in stack = Srinivas
Values are in stack = A
i=4
Employee =Srinivas : 163052campbell@********-laptop:~/java$
I couldn't reproduce the error you suffered.

You are using the stack incorrectly; you are using it as a List. It is a bit of bad design that Stack extends Vector, but if you use it as a stack you should only use the push() pop() peek() and isEmpty() methods.
Debasis behera
Greenhorn

Joined: Oct 26, 2009
Posts: 14
out put is:


stack.size()=5
Values are in stack = 12
Values are in stack = 23.6755
Values are in stack = Srinivas
Values are in stack = A
i=4
Employee =Srinivas : 163052


so no double will come



java
 
GeeCON Prague 2014
 
subject: Confused with System.out.print