class E92StringDemo {
public static void main(String args[]) throws java.io.IOException {
String strObj1 = "First String";
for (int i = 0; i < strObj1.length(); i++) {
System.out.print(strObj1.charAt(i));
System.in.read(); //just to pause the execution till i press enter key
}
}
}
I want the output to come like:
F
i
r
s
t...
but the output is coming like:
F
ir
st
S
tr
in
g
I am not sure how come 2 characters are getting displayed in one line with every press of an enter
key(
)?
I am running windows 8 and using a command prompt to run the file using javac
.