Announcement:

This is just the beginning of this blog, please don't copy any of my posts.

Sunday 23 December 2012

[JAVA] Define a class having three numbers as data members. Initialize and display the greatest of the three numbers.

Program to  Define a class having three numbers as data members. Initialize and display the greatest of the three numbers.

class Prog3

{
public static void main(String args[])
{
 int a=20,b=8,c=10;
 if(a>b && a>c)
 {
 System.out.println("The greatest no. is a:"+a);
 }
 else if(b>a && b>c)
 {
 System.out.println("The greatest no. is b:"+b);
 }
 else  if(c>a && c>b)
 {
 System.out.println("The greatest no. is c:"+c);
 }
 else
 {
 System.out.println("all are equal");
 }
}
}

Share it Please

Pankaj Gaikar

Pankaj Gaikar is a professional blogger from Pune, India who writes on Technology, Android, Gadgets, social media and latest tech updates at Punk Tech , Being Android & Shake The Tech . Email me HERE

0 comments :

Post a Comment

Copyright @ 2013 Pune University Bachelor of Engineering . Designed by Pankaj Gaikar | Love for The Tricks Machine