> Online tutorial : if statement java
Showing posts with label if statement java. Show all posts
Showing posts with label if statement java. Show all posts

if statement java

The if Statement
The if  statement allows conditional execution of a statement or a conditional
choice of two statements, executing one or the other but not both.
Syntax:


if ( Expression ) Statement
IfThenElse Statement:
if ( Expression ) StatementNoShortIf else Statement
IfThenElseStatementNoShortIf:
if ( Expression ) StatementNoShortIf else StatementNoShortIf

The Expression must have type boolean or Boolean, or a compile-time error
occurs.

Program
import java.io.*;
public class ifdat
{
public static void main(String args[])throws IOException
{
BufferedReader in=new BufferedReader(System.in);
InputStreamReader text=new InputStraemReader(in);
System.out.println("enter the salary");
String m=in.readLine();
int n=Integer.parseInt(m);
if(m<=1000)
{
int bon=m*.10;
System.out.println("bonus"+bon);
}
}
}