Example of if-else statements
This is example of if else statements.
SOURCE CODE
class IFELSEeg
{
public static void main(String args[])
int week=7;
String day;
if(weak==7)
day="sunday";
else if(weak==1)
day="monday";
else if(weak==2)
day="tuesday";
else if(weak==4)
day="thursday";
else if(weak==5)
day="friday";
else if(weak==6)
day="saturday";
else if(weak==3)
day="wednesdayday";
else
day="nothing";
System.out.println("sunday is in the"+day+".");
}
}
|
Download Source File