Home Tutorialhelp Comment This progrom does not work for all the values

 
 

Comment

Anuradha Mundinamani
This progrom does not work for all the values,
August 2, 2008 at 4:46 PM

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");

}
}
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
JDBC Questions

Insert option does not work in my jstl... - JDBC
Insert option does not work in my jstl...  I have problem... to store that values in a database... Pls solve my problem...... Joe... java herbert 

Java Beginners

How does the Java for each loop work?
How does the Java for each loop work?  How does the Java for each loop work 

Web Development

How does Social Media Marketing Work
How does Social Media Marketing Work In this section we will understand... Marketing really works for your website. How does Social Media Marketing Work... actually Works"? As you all know Internet users visits the Social Networking 

Java Beginners

import package.subpackage.* does not work
import package.subpackage.* does not work  I have 3 class files. A.java B.java C.java Below is the code block A.java:- package com.test...: cannot access A bad class file: .\A.java file does not contain class A Please remove 

Java Beginners

Package does not exist.. - Java Beginners
Package does not exist..  Hi.. thanks for ur Answers friend.. I have..... ERROR : javax.mail.*; ----> Package does not Exist.. Wat can i do now... Prabhu  Hi friend, The Java Mail API 1.4.1 supports JDK 1.4 or higher 

Java Beginners

Help Me in My Java Work
Help Me in My Java Work  Can you help me please... Write a Java..., and then calculate the average grade point value for all the marks entered. The GPA points... the user to enter a series of integer or decimal values ranging from 0 to 100 

PHP Questions

Jquery form validation does not work
effect does not work. Could you please solve this problem? Thanks!   ...Jquery form validation does not work  I want to use jquery validation for my Forms tags. I also imported necessary javascript files e.g. 

PHP Questions

Jquery form validation does not work
effect does not work. Could you please solve this problem? Thanks!   ...Jquery form validation does not work  I want to use jquery validation for my Forms tags. I also imported necessary javascript files e.g. 

Technology

How does LBS work?
How does LBS work?      ...), data and yellow pages for the service station. In spite of all mentioned... and service provider. First of all when the user activates the positioning device 

Java Beginners

OFbiz frame work - Java Beginners
 

Java Beginners

Collection frame work - Java Beginners
 

Ant Questions

jar file built by ant jar task does not have all the dependant jars and throws exception while reading the appplicationContext,xml
jar file built by ant jar task does not have all the dependant jars and throws... class with main method. Inside the class am trying to read the values...;/target> While executing the jar file using java -jar command it is throwing 

Java Beginners

Retaining textBox values in java - Java Beginners
Retaining textBox values in java  Hi all, i have a jsp screen where i have two actions . I have a single textbox and two buttons. My textbox... in java. thanks, Kiranmai 

Java Beginners

hi all - Java Beginners
hi all  hi, i need interview questions of the java asap can u please sendme to my mail   Hi, Hope you didnt have this eBook. You can download this at thislink... http://www.4shared.com/file/45195248/1f297b96 

Java Beginners

Java-Change Xml values - Java Beginners
Java-Change Xml values   test_final_1 2009-025T13:23:45 B2B I have the following xml.. I want to change the values of , and .. Can any one please tel me the code to update the values for the tags metioned above 

Software Services

How Does the Display Work for the iPad?
How Does the Display Work for the iPad? The iPad from Apple is a great... the display of the iPad works. It uses all sorts of great features that make it more.... It can work with horizontal or vertical displays. The problem 

Java-Tutorials

Get All Keys and Values of the Properties files in Java
Get All Keys and Values of the Properties files in Java... how to get all keys and it's values of the properties files in Java. Java provides the features to collection of all keys and values of the properties file 

General

Get All Keys and Values of the Properties files in Java
Get All Keys and Values of the Properties files in Java... to get all keys and values of the properties files in the Java. This section illustrates the way for getting all keys and corresponding values of the properties 

Java Beginners

does any one have sudoku in java - Java Beginners
does any one have sudoku in java   i need soduko in java using applets 

Java Beginners

values in combobox - Java Beginners
values in combobox  how to fill values in combo box i.e. select tag in html using javascript?   Hi Friend, Try the following code: ComboBox var arr = new Array(); arr[0] = new Array("-select-"); arr[1 

Java Beginners

shifting values - Java Beginners
shifting values  write a program to shift the array values in a circular way according to user's choice. user will supply the size of the array,array elements,the number of times the array will be shifted and also the direction 

Java Beginners

Reversing all root-to-leaf paths in a tree (JAVA) - Java Beginners
Reversing all root-to-leaf paths in a tree (JAVA)  A root-to-leaf... after reversing all root-to-leaf paths. For the following tree: root = 5... be useful to use linked lists to store the paths, but the code I wrote doesn't work 

Java Beginners

why java does not support multiple inheritance - Java Beginners
why java does not support multiple inheritance  hello friend, i...().show1(1,2); new A4().show1(3); } }  Hi Friend, Java does... complexity.Therefore java does not support it directly. Thanks 

Java Server Faces Questions

JSP Parse did not work - Java Server Faces Questions
("Feedback"); out.print("Selected Values are: "); for(int i=0;i DropDown DropDown... - to pass all the "multiple" feedback into the final output.jsp output.jsp 

Swing AWT

How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  ... ,update,delete database values from jtable only so i added three buttons add... of particular row is not getting added into the database whereas all other records 

Swing AWT

How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  ... ,update,delete database values from jtable only so i added three buttons add,update... row is not getting added into the database whereas all other records are getting 

Swing AWT

How to insert and update all column values of database from jtable.
How to insert and update all column values of database from jtable.  ... ,update,delete database values from jtable only so i added three buttons add,update... row is not getting added into the database whereas all other records are getting 

JavaScript Questions

Values to listbox
Values to listbox  I have two textboxes by the name street and city.I... the add button ,all the names of the people residing there are listed in listbox. Plz help me out with the coding in java script...plz 

JDBC Questions

How does this example work even if no oracle to be used and only access is available?
How does this example work even if no oracle to be used and only access is available?  CONNECTION CLASS package ExamplePackage; import java.sql.... = rs.next(); // if user does not exist set the isValid variable to false 

Java Beginners

java - Java Beginners
does it function and works. 2) what are the different types of search in JAVA explain all with example and how does that example work. thanks  ... link: http://www.roseindia.net/java/beginners/arrayexamples 

JSP Servlet Questions

display all the values on next page
display all the values on next page  i am inserting values... values are inserting in the database and i am moving on another page after... when i return on first page it should display my selected values in textbox 

Java Beginners

Finding all palindrome prime numbers - Java Beginners
Finding all palindrome prime numbers  How do i write a program to Find all palindrome prime numbers between two integers supplied as input (start and end points are excluded 

Java Beginners

sum of all values in a column of jtable
sum of all values in a column of jtable  hey everyone, is there a code to display the sum of all values in a column of a jtable namely CARTtbl... or deleted.   Here is an example of jtable that sums up the values of two 

Java Beginners

Object in java - Java Beginners
://www.roseindia.net/java/beginners/nonstaticvariable.shtml Thanks...Object in java  Hi deepak, I am new to java, can u tell me what... (variables and methods) that is shared by all its objects. It is a blue print 

Java Beginners

jvm work
jvm work  wht is the work of jvm? deaply.   Hi Friend, Java Virtual Machine or JVM for short is a software execution engine to run the java programs. Java Virtual Machine is also known as "Java Interpreter" which 

Java Beginners

sorting an array of string with duplicate values - Java Beginners
string with duplicate values  How to check the string with duplicate values 

Job Tips

Improve Your Assertiveness at Work
as the silence itself will speak on your behalf. However it does not work in this way... Improve Your Assertiveness at Work   ...; and ‘aggressive game’. The truth is that this principle does 

Java Beginners

java object - Java Beginners
java object  i want a complete memory description of objects,methods... and methods) that is shared by all its objects. It is a blue print for the creation of objects. The primitive data type and keyword void is work as a class object 

Java Beginners

Java Array Values to Global Varibles - Java Beginners
Java Array Values to Global Varibles  I am working on a program that provides users with 3 loan options. If global variables rate and periods... the value of certain mTerm[] and mRate[] arrays, I am unable to get those values 

Java Beginners

Does finally always execute in Java?
Does finally always execute in Java?  Does finally always execute in Java 

SQL Question

ALL command - SQL
ALL Command in Java & SQL  Nee all commands in Java.  Dear Manoj, I didn't get u what do u mean by all command. could u please... THAT ARE USED IN JAVA ARE GIVEN BELOW 1.javac c:\ javac classname.java 

JavaScript Questions

how to validate all form field values at once.
how to validate all form field values at once.  how to validate all form field values at once. condition:no form field shold contain sometext("--select 

JSP Servlet Questions

In tag files,does attribute values accept expressions or not? If not please explain the reason
In tag files,does attribute values accept expressions or not? If not please explain the reason  **Actually when i do manually in tomcat server... in tag file, attribute value does not accept any expressions 

Java Beginners

Does Java support multiple inheritance?
Does Java support multiple inheritance?  Hi, Does Java support multiple inheritance? thanks   hi, Please visit the following link: http://www.roseindia.net/java/language/inheritance.shtml Hope 

Struts Questions

validator framework work in Struts
validator framework work in Struts  How does validator framework work in Struts 

Struts Questions

Message Resource Bundle work.
Message Resource Bundle work.  How does Value replacement in Message Resource Bundle work 

JSP Servlet Questions

inserting all the values in a html table column
inserting all the values in a html table column  strong text hai everyone, i'm a fresher to servlet i need to know that, how can i insert all the values in a html table column into a database. Thanks in advance 

Java Beginners

sorting an array of string with duplicate values - Java Beginners
 

Java Beginners

sorting an array of string with duplicate values - Java Beginners
 

Java Beginners

sorting an array of string with duplicate values - Java Beginners
 

Java Beginners

java - Java Beginners
java   pl. explain me the selection sort of an integer array with example and how does it work or function? thanks 

Struts Questions

validate() method of ActionForm work
validate() method of ActionForm work  How does validate() method of ActionForm work 

Java Interview Questions

collection frame work
collection frame work  explain all the concept in collection frame work 

Java Beginners

java problem - Java Beginners
java problem  Room.java This file defines a class of Room objects...; The methods of class Room should include: A default constructor which does... the test program to check your work. Hotel.java This file declares a class 

XML Questions

retrieve multiple attribute values
XML retrieve multiple attribute values  Hello All Am a beginner...; What I would like is to retrieve both the attribute values of process... using Java. Thanks in advance 

XML Questions

retrieve multiple attribute values
retrieve multiple attribute values  Hello All Am a beginner. Would... like is to retrieve both the attribute values of process:Output during execution time, store them so that it can be retrieved for later use using Java. Thanks 

XML Questions

retrieve multiple attribute values
retrieve multiple attribute values  Hello All Am a beginner. Would... like is to retrieve both the attribute values of process:Output during execution time, store them so that it can be retrieved for later use using Java. Thanks 

Java Beginners

upload and download all kinds of files in jsp - Java Beginners
upload and download all kinds of files in jsp  how to upload and download all kinds of files ex: image file,pdf,.xls in jsp. your help is highly appreciated.  we can upload the all type s of files into oracle 10g 

Java Beginners

where are the all library files of netbeans 7.0 ? Because it does not import the file,"java.nio.file.Paths"
where are the all library files of netbeans 7.0 ? Because it does not import the file,"java.nio.file.Paths"  it shows message file does not exist 

Java Beginners

java programe - Java Beginners
java programe  Write a java program that does the following: 1. Switch the values of two variables using a method 2. Print the switched values onto the screen 

JDBC

Retrieving All Rows from a Database Table
MySQL database and java file so that the we can retrieve all data from... Retrieving All Rows from a Database Table       Here, you will learn how to retrieve all rows 

Java Beginners

java - Java Beginners
with mine and it does not work. Pls help, im begging you friends. Here...("insert into Student(id,FirstName,LastName,Address,ContactNo) values("+ide+",'"+v2...("insert into Student(id,FirstName,LastName,Address,ContactNo) values("+ide 

SQL Question

What is the difference between UNION and UNION ALL in SQL?
values). UNION ALL does the same, however it persists duplicate values i.e. UNION ALL selects all values. Thanks...What is the difference between UNION and UNION ALL in SQL?  What 

Java Beginners

Why does Java not support operator overloading?
Why does Java not support operator overloading?  Hi, Why does Java not support operator overloading? thanks 

Job Tips

Work Email- Dos and Don?ts
Work Email- Dos and Don’ts   ... and the Internet, emails are fast replacing letters in the realm of work..., keep track of a discussion- all very effortlessly. However in the fast 

JDBC Questions

ma access reading values
values throught servlet and register.jsp now i need code for reading values from...(table in my ms access) need to display values in jsp .............please help me dis is my login.jsp <%@ page language="java" contentType="text/html 

General

Site Map - All java tutorials
Site Map - All java tutorials In this section of sitemap we have listed all the important sections of java tutorials. Select the topics you want..., Spring, SQL, JSF and XML Tutorials.   These All Java Tutorials links 

Java Beginners

to all Experts.. please help me. im using a Jcreator. - Java Beginners
to all Experts.. please help me. im using a Jcreator.  3. Write a program that asks the user to enter a word. The program will then repeat word for as many times as it has characters: Enter a word: ILOVEU ILOVEU 

Java Beginners

java - Java Beginners
://www.roseindia.net/java/beginners/vectordemo.shtml Thanks...java   What is the difference between Wrapper Class and Vector Class... type to user defined data type. All the methods of the wrapper classes 

Java Beginners

java - Java Beginners
java  does java support call by reference?  Hi Friend, Java does not support Call by reference. It supports call-by-value for all variables running within a single VM. Thanks 

Java Beginners

java beginners - Java Beginners
the following links: http://www.roseindia.net/java/beginners/StringTokenizing.shtml http://www.roseindia.net/java/beginners/tokenizingjavasourcecode.shtml...java beginners  what is StringTokenizer? what is the funciton 

Mobile Applications Questions

ios work with nsdictionary
ios work with nsdictionary  How to work with NSDictionary..., in Objective C NSDictionary is used to create and retrive the Key values for objectecs. It's very simple to create and retrive the key values using NSDictionary .. please 

Java Beginners

Java programming - Java Beginners
to : http://www.roseindia.net/java/beginners/index.shtml Thanks...Java programming  hi sir, my question are as follows... hope u can solve my java programming problem.. Write a program to develop a class to hold 

Java-Tutorials

Java Method Return Multiple Values
Java Method Return Multiple Values In this section we will learn about how a method can return multiple values in Java. This example explains you how a multiple values can be return by a method. This example explains you all 

JDBC Questions

ma access reading values
question: dis is my login.jsp <%@ page language="java" contentType="text...) { alert ("Browser does not support HTTP Request") return... has to login . i already created ms access page and inserted values throught 

Java Beginners

how to return to main menu after adding all the info. - Java Beginners
how to return to main menu after adding all the info.  import java.util.Scanner; public class RegistrationSystem { public static void main(String[]args){ Scanner scan = new Scanner(System.in); int menu = 0 

Java Beginners

java - Java Beginners
java  i m doing project in java swing & JDBC my project topic is construction estimation system . For that i want to maintain a daily backup of work...){ ex.printStackTrace(); } } } But first of all, you need to create a bat file 

Java Beginners

How does Java handle integer overflows and underflows?
How does Java handle integer overflows and underflows?   hi, How does Java handle integer overflows and underflows? Thanks 

Java Beginners

JAVA QUESTIONS - Java Beginners
java questions asked in interview oracle  Hi all, Does anyone have a list of Java questions that is generally asked in Interview at Oracle 

Struts Questions

sing validator framework work in struts
sing validator framework work in struts  How does client side validation using validator framework work in struts 

Java Beginners

Platform dependent values like line separator, path separator - Java Beginners
Platform dependent values like line separator, path separator  Hi, How will you get the platform dependent values like line separator, path separator, etc., ? Thanks   Hi Friend, Using the following codes 

Java Beginners

java - Java Beginners
the values. Follow the same steps until all elements which are less than...: http://roseindia.net/java/beginners/arrayexamples/QuickSort.shtml Thanks... pick an element from array of elements called pivot. Then compare the the values 

Java Beginners

How java work on Unicode machanish
How java work on Unicode machanish   How the data are stored in java as unicode, how the conversions is done for input/output stream. Please describe in detail with memory aspect 

Java Beginners

sqllllllll - Java Beginners
,CONTPERTODATE,PONUM,VALUE,ESI,EPF) values('" + FORMID.trim() + "','" + replacestr... (col1,col2,col3) values('aa',todate(req.getParameter("bb")....,todate...; Hi Use this might be work, if not just clarify about the replacestr what 

Java-Tutorials

Java tutorial for beginners
and work on. The program developed in Java can be used on all operating systems...Java tutorials for beginners will help them learn the basic of Java.... Here is why a Java beginner should work on Java language and not any other 

Java Beginners

Java + Timer concept - Java Beginners
a function name as "getvalue()".This function does retrieve values(this value...Java + Timer concept  sir, I am using swing based model. My form... interval) and retrieve values and print it in console. I want code using timer 

Java Beginners

JFreeChart dosn't work
chart from JFreechart, but I just can't get it to work. The graph get its data... be the double values. I tried DefaultCategoryDataset, but every time I run it, an error occurs (i tried an example from here, with XY, and it didn't work either) I 

Java Beginners

How to return multiple values from a method - Java Beginners
How to return multiple values from a method  I came the following method "How do I return multiple values from a method?" posted elsewhere... = "Java"; protected String ivLastName = "Developer 

Java Beginners

How to return multiple values from a method - Java Beginners
How to return multiple values from a method  I came the following method "How do I return multiple values from a method?" posted elsewhere... = "Java"; protected String ivLastName = "Developer 

Java Beginners

How to extract the values of a variable in a href statement. - Java Beginners
How to extract the values of a variable in a href statement.  Hi, Here im trying to send invitations to some selected people.It is working when i...: SENDINVITE Now here i want to put a variable containing multiple e-mail ids 

Java Tips and Examples

Beginners Java Tutorial
Beginners Java Tutorial     ... with the Java Programming language. This tutorial is for beginners, who wants to learn Java from scratch. In this beginners Java Tutorial you will learn how 

Java Beginners

Hi Friend. on Default Data type Values - Java Beginners
Hi Friend. on Default Data type Values  Hi ... I have doubt on Default Data types... Is it Possible to print the Dafault Values..If it s so, Check this code..How to Print d Default Values 

Java Beginners

What is a pointer and does Java support pointers?
What is a pointer and does Java support pointers?   Hi, What is a pointer and does Java support pointers? Thanks   Hi, Pointer... to memory leaks and reliability issues hence Java doesn't support the usage of pointers 

Java Beginners

Thanks - Java Beginners
not try for previous problem becoz i m busy other work... please tell me what... friend, Uses of interface some points to be remember: 1. All variables... interfaces. Abstract class does not support Multiple Inheritance whereas 

Java Beginners

How to values from xml using java?
How to values from xml using java?  Hi All, I want to read value from following < Line> xml using java.. In < Line>,data is in format of key and value pair.. i want to read only values..could u plz help me 

Java Beginners

Hi...doubt on Packages - Java Beginners
of All classes. For read more information on Java Mail visit to : http...Hi...doubt on Packages  Does import.javax.mail.* is already Existing Package in java.. I have downloaded one program on Password Authentication 

Java Beginners

Error handling - Java Beginners
for a Java program. 1. Create a new Movie class which has two properties, title... a collection of Humans and another method showMovie which does not take any... family class that returns all family members. 5. In the main method of the Cinema 

JSP Servlet Questions

How to Work - JSP-Servlet
doing final year project using java,jsp,servlet.i only know java.i want details... model database program with where we save that program using jsp,servlet,java...; Hi friend, JSP : Java Server Pages or JSP for short is Sun's solution 

Java Beginners

Reply Me - Java Beginners
work it does is to check the web.xml file and determine what struts action Servlets exist. The container is responsible for mapping all the file request... jsp file and one java file Thanks Rajanikant  Hi friend, MVC : M 

Java-Tutorials

Online Java Compiler
Online Java Compiler provides the Java development environment online, which allows you to write and test Java code from anywhere. All you need... online. Online Java Compiler and runner gives you liberty to work from 

Advertisements Advertisements
 

 

 

DMCA.com