STUDENTS BEWARE: This assessment of the code is incorrect. Java ignores whitespace, so there is no nesting here, it's simply a regular IF/ELSE IF/IF statement. This is a great example of why best practice is to use brackets with your conditional statements. It's also a good example of why certain languages use "elif" instead of "else if" - Python does this, for example. In your case, the logic would work the same even if you added brackets after the first else, but this is not always the case. I'd give you an example, but this is meant as a short comment.
import java.util.Scanner; public class codechef{ public static void main(String args[]){ Scanner oii = new Scanner(System.in); int n = oii.nextInt(); if(n>10){ System.out.println("n is greater than 10"); } else if(n==10){ System.out.println("n is equal to 10"); } else{ System.out.println("n is less than 10"); } } }
STUDENTS BEWARE: This assessment of the code is incorrect. Java ignores whitespace, so there is no nesting here, it's simply a regular IF/ELSE IF/IF statement. This is a great example of why best practice is to use brackets with your conditional statements. It's also a good example of why certain languages use "elif" instead of "else if" - Python does this, for example. In your case, the logic would work the same even if you added brackets after the first else, but this is not always the case. I'd give you an example, but this is meant as a short comment.
pls gimme a example
Thanks so much, man! I only watched the first 44 secs to get what I'm looking for. Appreciate it!
Am here in 2024, thank you for making my java journey abit easier 😊
how's your java journey going so far?
Thanks a lot from India
Thanks for sharing. Very explanatory.
Awesome video Sir
Good
Exillient method of teaching..
good explanation man
Sir g opp kb kerwayn gy
Thanks neso academy
thank you sir
done
If I want total all videos of java what can I do sir???How can I get all videos????
Tel laga aur ulta let jaa
@@ArenDeager tune bhi yhi kia tha 😂😂😂
@@ArenDeager tu ja jake anime dekh. Vo hi kr skta h
When you say it saves time does it mean the time for compilation? 🤨
i can already tell your Lebanese from the accent, but thanks a lot mate.
they like using simple stuff
Shikanoko Nokonoko greaterThanTen
import java.util.Scanner;
public class codechef{
public static void main(String args[]){
Scanner oii = new Scanner(System.in);
int n = oii.nextInt();
if(n>10){
System.out.println("n is greater than 10");
}
else if(n==10){
System.out.println("n is equal to 10");
}
else{
System.out.println("n is less than 10");
}
}
}