Answer the question
In order to leave comments, you need to log in
How to make sure that when you enter the word "Man" in the console, the code in this if is executed?
System.out.println("Введите ваш пол");
if (?? ) {
double d = (x - y) * z;
System.out.println("Вес=" + d);
}
Answer the question
In order to leave comments, you need to log in
Greetings!
Here is a simple example:
public class Main {
public static void main(String ... args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Введите ваш пол:");
String gender = sc.nextLine();
if(gender.equals("Мужчина")) {
double d = (x - y) * z;
System.out.println("Вес=" + d);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question