Hey, I did this code with a video tutorial:
Why do I need to parse my preis variable to a double, if I declared the variable as a double above? Why don't I need to to this with Strings? .. [/php]
Code
import java.util.*;
public class DatenEingabe
{
public static void main(String[] args)
{
Scanner leser = new Scanner(System.in);
int anzahl;
double preis;
String bezeichnung, eingabe;
System.out.print("Geben Sie einen Preis ein: ");
eingabe = leser.nextLine();
preis = Double.parseDouble(eingabe);
System.out.printf("Anzahl: %.2f € %n", preis);
leser.close();
}
}Why do I need to parse my preis variable to a double, if I declared the variable as a double above? Why don't I need to to this with Strings? .. [/php]
Feel free to ask me any question about RAT's. I am there to answer them all. My skype is: kim.kertani



