Ayo Ayo

Greenhorn
+ Follow
since Sep 05, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ayo Ayo

Hello all,

I know I am quite to new Java Programming, hence the reason why my computer crashes often when I compile some programs. However is there any Java statemnet you can use that tells the compiler to send out an error message and aborting rather than the computer crashing? I tried using the 'throws IOException'in the main method but it does not work. Thank you.

Ayo
18 years ago
Thanks a lot Joanne Neal.

Ayo Ayo
18 years ago
Hello all,

I am trying to write a program that prompts the user to enter a single character e.g 'Y'. The problem is that when I try to read it using the BufferedReader Object: readLine() method and do some comparism with another char variable, it gives me the wrong result, ie always 'No' No matter the input. Does anybody know of a method used to read in a single character?

My code is as follows;

String InData;
String intData1 = "Y"';
BufferedReader dataString =
new BufferedReader (new InputStreamReader(System.in));
System.out.println("Would you like pin strip (�250.00) Y/N"); InData=dataString.readLine();

if(InData1=='InData')
{
System.out.println("ok");
}
else
{
System.out.println("No");
}

THANKS
18 years ago