I've got a huge problem. Our teacher told us to use this line to read data:
Scanner scan = new Scanner(System.in);
And then to read numbers = scan.nextInt();
And to read Strings = scan.nextLine();
And now i got a mission to make a program to change letters to numbers. a should be 97 and so on. I wrote this script:
public class Ex33 {
public static void main(String[] args){
Scanner Keyboard = new Scanner(System.in);
char tecken = 'a';
System.out.println("Tecken = " + tecken);
System.out.print("Enter a new sign: ");
tecken = Keyboard.readChar();
System.out.println("Tecken = " + tecken);
}
}
The only problem is that the class Scanner doesint support char at all, so im wondering if anyone know what class to use to read data, since Scanner fails to support char and therefor also fails to support switch and so on.
Please help me //Confused student
Scanner scan = new Scanner(System.in);
And then to read numbers = scan.nextInt();
And to read Strings = scan.nextLine();
And now i got a mission to make a program to change letters to numbers. a should be 97 and so on. I wrote this script:
public class Ex33 {
public static void main(String[] args){
Scanner Keyboard = new Scanner(System.in);
char tecken = 'a';
System.out.println("Tecken = " + tecken);
System.out.print("Enter a new sign: ");
tecken = Keyboard.readChar();
System.out.println("Tecken = " + tecken);
}
}
The only problem is that the class Scanner doesint support char at all, so im wondering if anyone know what class to use to read data, since Scanner fails to support char and therefor also fails to support switch and so on.
Please help me //Confused student