Wednesday, November 19, 2008

கணனி மொழியின் அரசன் JAVA 04

if Statement

நிபந்தனை உண்மையாயின் (true) தன்னுள்ளே(if) வரையறுக்கப்பட்ட கட்டளைகளை நிறைவேற்றும். பொய்(false) யாயின் else பகுதியின் கட்டளைகளை நிறைவேற்றும்

1) if(boolean condition)
// single body statement




2) if(boolean condition)
{ // body statement }

else
{ //body statment}
}

பின்வரும் code னை டைப் செய்யவும்



import javax.swing.JOptionPane;
public class Fifth
{
static int option;
public static void main (String [] arg)
{

String result;

result= JOptionPane.showInputDialog("Enter your marks");

int resultvalue= Integer.parseInt( result );

if(resultvalue>=75)

JOptionPane.showMessageDialog(null,"Result is : A");

else if(resultvalue>=60)

JOptionPane.showMessageDialog(null,"Result is: B ");

else if(resultvalue>=40)

JOptionPane.showMessageDialog(null,"Result is : C");

else
JOptionPane.showMessageDialog(null,"Result is :F");

}
}

Output




1 comment:

Mohamed Nafly said...

Great article structure...
Please keep going..