0
Java Scanner
import java.util.Scanner; public class Program { public static void main(String[] args) { String a = "a"; Scanner b = new Scanner(System.in); String c = b.next(); System.out.println("Odessa its:"); System.out.println("a - City"); System.out.println("b - Country"); if(a == c){ System.out.println("You win"); } else { System.out.println("You lose"); } What you lose if you enter the value of a
5 Respuestas
+ 14
// That's why we use the equals() method instead ;)
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
String a = "a";
Scanner b = new Scanner(System.in);
String c = b.next();
System.out.println("Odessa its:");
System.out.println("a - City");
System.out.println("b - Country");
if(a.equals(c)){
System.out.println("You win");
}
else {
System.out.println("You lose");
}
}
}
+ 12
It's okay @Marko, you can still have a quick look at it in the Java course.
https://www.sololearn.com/Course/Java/?ref=app
+ 4
https://www.sololearn.com/Discuss/321242/?ref=app
+ 4
dev thx
oh I have not yet learned this method, or rather I did not know about it at all 1 day I learn the language of java
0
I have learned the equals() thanks to this but can you tell me the greater than or less than equivilent.