Article View: aus.computers.java
Article #549Wierd system.out.println
From: Nicholas Routledge
Date: Wed, 23 Aug 2000 00:00
Date: Wed, 23 Aug 2000 00:00
47 lines
2166 bytes
2166 bytes
Hi all,
I'm having this extremely frustrating problem that i can't see to fix.
I have a method called processRequest and when called, returns a string.
After processRequest is called, the string that is returned is assigned to a
variable called status.
this is what i have next,
if (status.equals("Confirm")) {
...
System.out.println("Confirm (Y/N): ");
char c = (char) br.read();
...
}
else if (status.equals("Alternate")) {
...
System.out.println("Confirm (Y/N): ");
char c = (char) br.read();
...
}
.
.
Now the problem is, the System.out.println statements in each conditional
branch are executed TWICE for some reason. They should only be executed
once because the statements are not nested inside a loop. Also, i have no
recursion anywhere in the program.
For example, if the first branch is taken, it prints out,
"Confirm (Y/N): "
"Confirm (Y/N): "
Its extremely wierd but i was wondering whether anyone had any suggestions
or whether anyone had seen this problem before?
I can't explain it.
--
cheers,
Nick
=================================
Nicholas Routledge
ICQ#: 41114416
Website: http://users.bigpond.com/n.routledge/
Email: s371556@student.uq.edu.au
=================================
Technical Details
Message-ID:
<s5Oo5.36404$c5.101625@newsfeeds.bigpond.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,23055c9aac63ea4a,start X-Google-Attributes: gid10d6db,public X-Google-Thread: 113ae9,23055c9aac63ea4a,start X-Google-Attributes: gid113ae9,public X-Google-Thread: 10a146,23055c9aac63ea4a,start X-Google-Attributes: gid10a146,public From: "Nicholas Routledge" <n.routledge@bigpond.com> Subject: Wierd system.out.println Date: 2000/08/23 Message-ID: <s5Oo5.36404$c5.101625@newsfeeds.bigpond.com> X-Deja-AN: 661492117 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Trace: newsfeeds.bigpond.com 967028184 203.54.129.72 (Wed, 23 Aug 2000 20:56:24 EST) Organization: Telstra BigPond Internet Services (http://www.bigpond.com) X-MSMail-Priority: Normal NNTP-Posting-Date: Wed, 23 Aug 2000 20:56:24 EST Newsgroups: aus.computers.java,comp.lang.java.help,comp.lang.java.programmer