+ 2
Why this code doesn't work?
Please help me. It is very important. import java.util.Scanner; import java.util.Random; import static java.lang.System.out; public class WennDasKlapptIchSchwoer { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String beschreibung = keyboard.next(); switch (beschreibung) { case "Sehr gut": out.println('A'); break; } } }
4 Answers
+ 17
Use keyboard.nextLine();
/* this method takes input including space, but next() doesn't
next() is only taking Sehr */
+ 10
Its System.out.println();
+ 2
@Shamima Yasmin thank you very much đ. Puh I worked on a long code about 2 hours. and I didn't finde the false thing, because there wasn't a compile error
+ 1
@Dayvne I have imported the static java.lang.System.out class, so I dont need to write every time when I need to print something out write SYSTEM. out.println ();
But thank you for your try to help me.