Answer the question
In order to leave comments, you need to log in
What is the problem in java code?
Hi everyone
, I'm learning java, from the lessons on youtube
he will see the code in the video, I decided to write it myself but it doesn't work
public class Hello {
public static void main(String[] args) {
Scanner scanner = new Scanner (System.in);
int rezult = scanner.nextInt();
if (rezult = 0) {
System.out.println (this is 0);
}
else {
System.out.println (is not 0);
}
}
}
Answer the question
In order to leave comments, you need to log in
The comparison in the if block is wrong, it should be with two equals ==
if (rezult == 0) {
System.out.println (this is 0);
}
else {
System.out.println (is not 0);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question