+ 2

code not working [solved]

pls help my java code is not working . This is my first code in java and it's not working https://code.sololearn.com/c5dp5jZ4SH98/?ref=app

19th Nov 2020, 4:43 PM
Yash Arora🇮🇳
Yash Arora🇮🇳 - avatar
10 ответов
+ 5
20th Nov 2020, 2:16 AM
Simba
Simba - avatar
+ 5
Simple example import java.util.Scanner; public class TestScanner { public static void main(String[] args) { try ( Scanner scanner = new Scanner( System.in ) ) { System.out.print( "Veuillez saisir un premier entier : " ); int a = scanner.nextInt(); System.out.print( "Veuillez saisir un second entier : " ); int b = scanner.nextInt(); int result = a + b; System.out.printf( "La somme de %d et de %d vaut %d\n", a, b, result ); } } }
19th Nov 2020, 10:28 PM
HAMYD KHADDA
HAMYD KHADDA - avatar
+ 2
Benjamin Jürgens like this: Scanner a b=new Scanner(System.in);
19th Nov 2020, 7:12 PM
Yash Arora🇮🇳
Yash Arora🇮🇳 - avatar
+ 2
Simba thanks a lot
20th Nov 2020, 7:29 AM
Yash Arora🇮🇳
Yash Arora🇮🇳 - avatar
+ 1
Share your attempts please
19th Nov 2020, 4:52 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
19th Nov 2020, 5:06 PM
Yash Arora🇮🇳
Yash Arora🇮🇳 - avatar
+ 1
Use only one scanner. Input numbers on the same line, separated by a space
19th Nov 2020, 7:09 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
20th Nov 2020, 7:30 AM
Yash Arora🇮🇳
Yash Arora🇮🇳 - avatar
0
Yash Arora🇮🇳 you are using double x= sc.nextInt(): But if you want to take integer value from keyboard/user then you have to take : int x =sc.nextInt()
20th Nov 2020, 8:34 AM
ARYAN GARG
ARYAN GARG - avatar
- 2
D
20th Nov 2020, 5:48 PM
Rashid Alkhamri
Rashid Alkhamri - avatar