0

Good morning friends(HK Time😂) Could you tell me how to input several imports?Thank you!

Import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("integerx: "); int x = input.nextInt(); System.out.print("Real number: "); double y = input.nextDouble(); System.out.printf("x =%3d y=%6.2f\n", x,y); } }

19th Jun 2018, 12:31 AM
Hunt
Hunt - avatar
2 Antworten
+ 5
Appears to work fine. You just have to fix the problem with your import keyword. It is "import" and not "Import". If you are running this code in Code Playground, multiple input can be accepted by splitting input into different lines. E.g. type 1 1.1 into the input text box.
19th Jun 2018, 2:50 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
I know how to operate it now,thanks!
19th Jun 2018, 5:35 AM
Hunt
Hunt - avatar