
always getting an error how to fix this (( if (Choice == 'Borrow' || Choice == 'borrow') ))

always getting an error how to fix this (( if (Choice == 'Borrow' || Choice == 'borrow') ))
 
    
     
    
    In Java, Strings should be quoted like "this", not like 'this'. The second syntax is used for individual characters.
Since you're using charAt(0), you are already getting the first character of the string, so you should be comparing to the individual characters 'b' and 'B'.
 
    
    luiscubal is right and if you want to compare the string instead of the first carachter, you can use Choice = zam.next(); wich returns a String and compare it using Choice.equals("Borrow").
You get an error when you on Choice = zam.next() because zam.next() returns a String and you probably declared Choice as a char.
 
    
    Scanner sc = new Scanner(System.in);
System.out.println("Veuillez saisir un mot :");
String str = sc.nextLine();
System.out.println("Vous avez saisi : " + str);
if (src == "Borrow"|| Choice == "borrow"){
    System.out.println("You are borrow ");
}
Le mieux est d'éviter de faire des tests inutiles:
// supprime les espaces avant et apres le mot entré sur l'ui
String sansEspace = src. trim();
// remplace les majuscule par des minuscule
String formated = sansEspace.toLowerCase();
// faire qu'un seul test
if (formated == "borrow"){
    System.out.println("You are borrow ");
}
