CH Low

Greenhorn
+ Follow
since Aug 25, 2001
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 CH Low

I tried writing a String input method and had a problem
with throwing IOException so i tried to use a try/catch statement, but then
the variable to be returned is said to be "not initialised" by the
compiler. wats the problem? can anyone help? here's the code;
public static String getString()
{
InputStreamReader input;
BufferedReader bR;
String s;
try{
input = new InputStreamReader(System.in);
bR = new BufferedReader(input);
s = bR.readLine();
}
catch (IOException e)
{
System.out.println("error");
System.exit(0);
}
return s; // there seems to be a problem with returning s!
}
22 years ago