aspose file tools*
The moose likes Beginning Java and the fly likes unexpected output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "unexpected output" Watch "unexpected output" New topic
Author

unexpected output

jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
hi im a newbie here.... ,
im having a little problems with the output in my program
output:

the whole code is

Andrew Robinson
Greenhorn

Joined: Jan 06, 2010
Posts: 15
what is the output supposed to look like? Can you show how the program is supposed to flow like sample input and outputs?
R Johnson
Greenhorn

Joined: Jan 05, 2010
Posts: 28

It has teh output that you desire when I compile it. Here was my output

Enter The Coins: 1

Bet (Max: 1 - 4 Coins): 2

1 BELL BELL GRAPE

Bet (Max: 1 - 4 Coins): 1

2 BELL CHERRY ------

Bet (Max: 1 - 4 Coins): 4

3 CHERRY BELL GRAPE

Bet (Max: 1 - 4 Coins): 4

4 BELL CHERRY GRAPE

Bet (Max: 1 - 4 Coins):
5 CHERRY ------ ------

4
Bet (Max: 1 - 4 Coins): |

as you can see it may just be a java return character because you show you have two Bets printed before the cursor

Bet (Max: 1 - 4 Coins): Bet (Max: 1 - 4 Coins): //should be here


I am confused though on the importance of the location of the cursor........ once you get too swing applications I feel console cursor placement may be of little or no importance.
jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
no sir... in my IDE its printing at the line after the desired location, and the output is two? i mean duplicated... T_T
jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
its exactly as this sir
duplicated output and the readLine is ON THE NEXT Line
jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
i've been encountering this kind of output ever since, but no one can explain why, because no one is expriencing that same output like i do, (probably)
they responded the same as your did sir.. they also get the desired output... no problems , no readLine problems. no duplicates..
but when i compile-run it in my IDE, everything is still the same as before,

im using NetBeans IDE 6.7 / jdk1.6_07 update 13
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11480
    
  94

What happens if you run it from the command line?

I suspect that this is just a bug with how NetBeans is trying to emulate a terminal - it is not placing the cursor in the right place. When I run it within Eclipse on a Mac, the cursor initially appears at the start of the line (that is, before the "E" in "Enter The Coins"), but as soon as soon as I start typing the number of coins it jumps to the correct place following the colon. However when I run the same application from the command line the cursor is always in the right place.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
sir i beg your pardon,, but what is command line?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

jhon max wrote:sir i beg your pardon,, but what is command line?

Command Prompt


[My Blog]
All roads lead to JavaRanch
jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
thank you sir
jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45
sir andrew.. it works fine in a command line.. but why is does it display wrong in my IDE?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unexpected output