Decision Making

We use decision making when we want to skip some of the statements in our program as per the condition.
1.if statement:This statement checks for the if condition and executes the statements if it is true.Example:
[java]
public class greater
{
public static void main(String args[])
{
if(3>1)
{
System.out.println(“3 is greater than 1”);
}
}
}
[/java]
Output:
3 is greater than 1.

2.if else-It checks for the condition and executes the statements in if block if the condition is true .If the condition is false,statements in the else block are executed.Example:
[java]
public class greater
{
public static void main(String args[])
{
if(3>8)
{
System.out.println(“False”);
}
else
{
System.out.println(“True”);
}
}
}
[/java]

Itsourcecode is designed to help those newbie programmers to widen their knowledge and enhance their skills in programming through free source code from different programming languages such as VB.net, PHP, Java, HTML, CSS, etc.