Hi there folks.
I'm using JBuilder 6 Enterprise edition.
I'm trying to compile the following code:-
import java.io.IOException;
class InputDemo {
public static void main(
String args[]) {
try {
// Input a single character
System.out.println("Type a character:");
char ch = (char)System.in.read();
System.out.println("You entered: " + ch);
// Throw out new line
while (ch != '/n')
ch = (char)System.in.read();
// Input a string
System.out.println("Type a string:");
StringBuffer s = new StringBuffer();
while ((ch = (char)System.in.read()) != '/n')
s.append(ch);
System.out.println("You entered: " + s);
} catch (IOException e) {
System.out.println("Input error detected");
}
}
}
But when i try and compile this, i get the following error messages:-
"InputDemo.java": Error #: 106 : unclosed character literal at line 11, column 18"
&
"InputDemo.java": Error #: 106 : unclosed character literal at line 16, column 48
Line 11 is - while (ch != '/n')
Line 16 is -
while ((ch = (char)System.in.read()) != '/n')
Does anybody know why i'm getting these erors??
Any help would be GREATLY appreciated