Showing posts with label Study Notes. Show all posts
Showing posts with label Study Notes. Show all posts

Friday, January 30, 2015

Working of Conditional Operator in Java


http://indiancomputerwizard.blogspot.in/
Working of  Conditional Operator in Java
import java.util.Scanner;
class ConditionalOperator
{
public static void main(String args[])
{
int a,b,c,result;
Scanner input=new Scanner(System.in);
System.out.print("Enter the value of a b and c ");
System.out.println("");
a=input.nextInt();
b=input.nextInt();
c=input.nextInt();
result=(a>b)?((a>c)?a:c):((b>c)?b:c);
System.out.println("The largest no is: "+result);
}
}
OUTPUT
http://indiancomputerwizard.blogspot.in/

Increment and Decrement operators in Java



http://indiancomputerwizard.blogspot.in/
Increment and Decrement operators in Java
class IncrementOperator
{
 public static void main(String args[])
   {
     int m=10,n=20;
     System.out.println("m= " +m);
     System.out.println("n= " +n);
     System.out.println("++m= " + ++m);
     System.out.println("n++= " + n++);
     System.out.println("m= " +m);
     System.out.println("n= " +n);
   }
}
OUTPUT
http://indiancomputerwizard.blogspot.in/

Blog Archive