+ 2

could you tell me what is my mistake

import java.util.Scanner; class MyClass { public static void main(String[] args) { Scanner m = new Scanner(System.in); String a = m.nextline(); String b = "bonjour"; if (a == b){ System.out.println("bonjour comment allez vous"); } else{ System.out.println("desole je ne comprend pas"); } } }

7th Jul 2018, 1:18 PM
Raitovin
Raitovin - avatar
8 Antworten
+ 5
Donna your so considerate. That is good
8th Jul 2018, 1:10 AM
Surath Singh
Surath Singh - avatar
+ 4
replace: if(a==b){ with: if(a.equals(b)){
7th Jul 2018, 1:19 PM
KrOW
KrOW - avatar
+ 2
ok thanks
7th Jul 2018, 1:20 PM
Raitovin
Raitovin - avatar
+ 2
ok thanks
7th Jul 2018, 2:27 PM
Raitovin
Raitovin - avatar
+ 1
but SoloLearn say I have a error one the point of m. nextline
7th Jul 2018, 1:22 PM
Raitovin
Raitovin - avatar
+ 1
but the program does not work
7th Jul 2018, 1:28 PM
Raitovin
Raitovin - avatar
+ 1
thank you very much
7th Jul 2018, 1:49 PM
Raitovin
Raitovin - avatar
0
use m.next()
7th Jul 2018, 1:47 PM
Nikhil Sharma
Nikhil Sharma - avatar