Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
Null pointer excep
swap program faile
hi.........
very good
navigaton mobile
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Java Beginners Largernumber

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

12 comments so far (post your own) View All Comments Latest 10 Comments:

there should be an else statment in the main else..

public static void main(String[] args)
{
int x=5,y=0,z=3;
if(x>y)
{
if(x>z)
System.out.println(x);
else
{
if(z>y)
System.out.println(z);
else
System.out.println(y);
}
}
else
{
if(y>z)
System.out.println(y);
else
System.out.println(z);
}
}

Posted by Champ on Sunday, 04.5.09 @ 01:03am | #86512

This is another type of example for finding the largest number.
class velu1
{
public static void main(String args[])
{
int a=3,b=1,c=4;
if (a>b && a>c)
{
System.out.println("a is greatest");
}
else
if (b>c && b>a)
{
System.out.println("b is greatest");
}
else
if (c>a && c>b)
{
System.out.println("c is greatest");
}
}
}

Posted by veluswamy on Saturday, 08.23.08 @ 22:41pm | #74656

For example,
If x = 2, y = 200 and z = 400
this program does not produce the output as it never compares y and z separately.

I think another line of code should be added as in:
class LargerNumber{
public static void main(String[] args) {
int x=2, y=70, z=3000;
if (x>y){
if (x>z){
System.out.println("x is greater");
}
else{
if(z>y){
System.out.println("z is greater");
}
else{
System.out.println("y is greater");
}
}
}
else if (y>z){
System.out.println("y is greater");
}

else
System.out.println("z is greater");

}
}

Posted by Anuradha Mundinamani on Saturday, 08.2.08 @ 16:46pm | #70536

in above this program we are initiating no to variables other than this declare only variables and compare and they should read the values at compilation time ao simply what is the syntax for input of charater or nos.

Posted by lavanya on Monday, 04.28.08 @ 22:27pm | #58083

thanks a lot

Posted by pankaj jha on Thursday, 02.7.08 @ 14:40pm | #47504

class greaternumber
{
public static void main(String[] args)
{
int x=100,y=200,z=12;
if (x>y && y>z)
{
System.out.println("x is the Greater number");
}
else if(z>x && z>y)
{
System.out.println ("Z is the larget number");
}
else
{
System.out.println("Y is the larger number");
}
}
}

Posted by mangalamalatkar on Wednesday, 04.25.07 @ 16:40pm | #14917

BEING FRIENDLY AM HAPPY THAT NOW I CAN DO JUST A THING WITH JAVA.IT TAKES ME MORE THAN 3 WEEKS NOW TRYING TO UNDERSTAND WHAT WAS BEING TOUGHT BUT TODAY &I MEAN THIS DAY AM CAPABLE....KEEP ON HELPING US..THANX A LOT

Posted by l'ness on Thursday, 04.12.07 @ 00:05am | #13911

If the task is display the largest number among 100 integers, then what would be the solution, should we folow IF condition or Loop or something else please send the coding or the logic if anyone could solve this?

Posted by Shajib on Thursday, 03.15.07 @ 23:02pm | #11839

please explain me about (string[] args) in the main method

Posted by pranitha on Tuesday, 02.20.07 @ 04:52am | #8421

Thank you very much for setting up the example and sharing the code. I feel there may be some redundancy after the first else statement.
Best Regards,
Kim

Posted by Kim Tran on Thursday, 02.1.07 @ 16:04pm | #5204

ya this example is too good , but if it is some what diffecult that will be better ok eny way thanks for this examples

Posted by sharath pawar on Tuesday, 01.23.07 @ 16:46pm | #4143

please give more explanation for the above example

Posted by visakh m g on Friday, 12.1.06 @ 14:13pm | #318

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.