and i just found another code similar to this but using bufferedreader somewhat like that and had the same output.. what are there difference? thanks.
import java.util.*;
import static java.lang.System.out;
public class charaAtdummy {
public static void main (String how[]) {
[COLOR=Red]try {[/COLOR]
Scanner Input = new Scanner (System.in);
int length;
char Char;
out.print("enter string: ");
String string = Input.nextLine ();
[COLOR=Red]length = string.length ();[/COLOR]
out.println(length);
[COLOR=Red]Char = string.charAt (4);[/COLOR]
out.print(Char);
}
[COLOR=Red]catch(Exception e){} [/COLOR]
}
}


Sign In
Create Account


Back to top









