I just started my adventure of programming yesterday and already have a problem I can't solve. I tried to make my program ask me for my age and to return it to me.
I entered 24 and it returned 50. I managed to find out that it uses the Ascii chart or something like that and that it converts only the very first number to a decimal number. So in this case 2->50.
I tried to find a solution online but I only found things about converting numbers to characters.
I am sorry if I missed the obvious and my question is redundant but I really don't have any experience in programming and don't know what else to google.
This is my code:
package de.galileocomputing.schroedinger.java.kapitel01;
import java.io.IOException;
public class HalloSchroedinger {
public static void main(String[] args) throws IOException {
System.out.println("Hallo " + args[0]);
System.out.println("Wie alt bist du?");
int alter = System.in.read();
System.out.println(alter);
}
}