Professional Documents
Culture Documents
YouTube 39K
Advertisements
Syntax
Java Tutorial Following is the syntax of an if...else statement −
Java - Numbers
Java - Characters
Java - Strings
Java - Arrays
if( x < 20 ) {
System.out.print("This is if statement");
Java Object Oriented }else {
System.out.print("This is else statement");
Java - Inheritance }
}
Java - Overriding }
Java - Abstraction
Output
Java - Encapsulation
This is else statement
Java - Interfaces
Java - Data Structures When using if, else if, else statements there are a few points to keep in mind.
Java - Collections An if can have zero or one else's and it must come after any else if's.
Java - Generics An if can have zero to many else if's and they must come before the
Java - Serialization else.
Java - Networking Once an else if succeeds, none of the remaining else if's or else's will
be tested.
Java - Sending Email
Output
Value of X is 30
Advertisements
Ad
Write for us FAQ's Helping Contact © Copyright 2018. All Rights Reserved. Enter email for newsletter go