Home Tutorialhelp Comment if x is the smallest then it doesnt work

 
 

Comment

Champ
if x is the smallest then it doesnt work,
April 5, 2009 at 1:03 AM

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);
}
}
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java Beginners

doesnt run again - Java Beginners
doesnt run again  the code u sent doesnt run and the error msg says...]); } System.out.print ("\nEnter your choice:"); int x ; x... it??"); y=in.nextInt(); total+=orderPrice[x]*y; bellObj [counter 

Java Beginners

letter counting for the smallest word
letter counting for the smallest word  How do I program my java program to only count the letters in the smallest of two words? this is what I have and it works EXCEPT that it counts all of the letters not just the smallest word 

Java Beginners

OFbiz frame work - Java Beginners
 

Java Beginners

Collection frame work - Java Beginners
 

Java Beginners

The largest integer among the X number
) The smallest integer among the X number of integers keyed in The program...The largest integer among the X number  Write an application program that prompts the user to key in a whole number X. The user is then prompted 

J2EE-Tutorials

Final Cut Pro X
Final Cut Pro X The Final Cut Pro X is the name of new innovation in the video... this, it also helps them in details about FCP X user interface and latest... during video editing. In fact, today Final Cut Pro X has created 

Java Technology Tutorials

Get the smallest double greater than the given value
Get the smallest double greater than the given value This section demonstrates you how to get the smallest double value greater than the given value. Java... and generate the new smallest double value which greater than the specified 

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 Interview Questions

1.Computing cos(x) using the cosine series: Recall that cos(x) is given by the following series: - Java Interview Questions
1.Computing cos(x) using the cosine series: Recall that cos(x) is given by the following series:   Write a program to compute cosine of a number x... main(String[] args) { double x = 0.50; System.out.println(Math.acos(x 

Java Beginners

java programming - Java Beginners
java programming  Can you make me a run java program for sorted distinct numbers largest to smallest..thanks ahead...I really need also...*; class Sort{ public static void doSorting(int[] x) { int temp 

Java Beginners

JFreeChart dosn't work
chart from JFreechart, but I just can't get it to work. The graph get its data... as a String). The X-axis should be the different string, and the Y-axis should... it, an error occurs (i tried an example from here, with XY, and it didn't work either) I 

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

Perfect Numbers - Java Beginners
+ 2 + 3 Write a java program that finds and prints the three smallest perfect... class PerfectNumber{ public static void main(String[]args){ int sum=0, x=0 

Java Beginners

Finding smallest value, then the next etc
Finding smallest value, then the next etc  hi, I know how to search for the smallest value index in an unsorted array so far with this: double... becomes true, I want to search for next smallest value that isn't the one I just 

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

Java Basics - Java Beginners
reference using new operator den == doesnt work... so m confused pls let me knw...Java Basics  hi, i want toknw d full details of this. actually we knw dat for string comparison we use equals() method. but i did like dis 

OpenSourceSoftware

Mac OS X Open Source
with the Java Web Services pack.  Open Source software for Mac OS X...; Bringing your Java Application to Mac OS X There is a market full... Java application a native look and feel so that Mac OS X users can install 

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 

Java Beginners

Help Me in My Java Work
Help Me in My Java Work  Can you help me please... Write a Java application, to be called GpaCalculator, which will return a grade point average (GPA) when given a range of decimal figures representing a selection of exam marks 

Java Beginners

NoughtsAndCrossesGame play button doesn't work
NoughtsAndCrossesGame play button doesn't work   /* * To change... (button press count) then it is "X" // shot as "X" player always...) { currentButton.setText("X"); } else { currentButton.setText("0 

Java Beginners

NoughtsAndCrossesGame play button doesn't work
NoughtsAndCrossesGame play button doesn't work   /* * To change... (button press count) then it is "X" // shot as "X" player always...) { currentButton.setText("X"); } else { currentButton.setText("0 

General

X - Java Terms
X - Java Terms       Java API for XML-based Remote Procedure Calls JAX-RPC stands for Java API for XML-based RPC. The RPC (Remote Procedure Call 

Programming Tutorials

X-Chat
X-Chat       X-Chat has two good features of usability: colored nicknames and alignment by text as opposed to alignment by nicks. When you read text, it's enough for eyes to notice 

Java Technology Tutorials

Incrementing a Double by the Smallest Possible Amount
Incrementing a Double by the Smallest Possible Amount In this section, you will earn how to increment the double value by the smallest possible amount... by the smallest possible amount, we have invoked the previousDouble() method of ChoiceFormat 

Java Beginners

Circle question - Java Beginners
Circle question  Hey You helped me with one this question already but the code you gave doesnt seem to work any more ideas? Write an application that uses Circle class you created in the previous assignment. ? The program 

Java Beginners

Programming with Java - Java Beginners
Programming with Java    Using valid Java code from Chapter 1 to 6, create an object oriented(Java application ) program with a minimum of two... with dynamic allocation, in your java test program class to initialize all 

Java Beginners

java - Java Beginners
java  write a java programme to draw diagram for function f(x)=x*x 

Java Beginners

Avl tre problem code - Java Beginners
// // ******************PUBLIC OPERATIONS********************* // void insert( x ) --> Insert x // void remove( x ) --> Remove x (unimplemented) // Comparable find( x ) --> Return item that matches x 

Java Beginners

Java Program - Java Beginners
Java Program  A Java Program that input 10 Numbers and find out the smallest amoung them without using Array.  Hi Friend, Try...) { small = number; } } System.out.println("Smallest Number 

Java Beginners

x-axis and y-axis
x-axis and y-axis  hi,, i want to to write a program that display a graph of x-axis and y-xais when i entered the parameters of the function 

Java Beginners

java - Java Beginners
); } } For more information on java visit to : http://www.roseindia.net/java/beginners... define an array like this: char array = {'X','B','C','D','E'};   ... { public static void main(String[] args) { char array[] = {'X','B','C','D','E 

Java Beginners

java - Java Beginners
java  WAP that reads five integers,determines and print the largest and smallest integer in a group.  Hi Friend, Try the following code...= " + big); System.out.println("Smallest Number= " + small 

JDBC Questions

Insert option does not work in my jstl... - JDBC
Insert option does not work in my jstl...  I have problem with this jstl code... This will extract and displays details from xml... But i cant able... java herbert 

Java Beginners

small java project - Java Beginners
small java project  i've just started using java at work and i need to get my self up to speed with it, can you give me a small java for beginners project to work on. your concern will be highly appreciated 

Java Beginners

small java project - Java Beginners
small java project  i've just started using java at work and i need to get my self up to speed with it, can you give me a small java for beginners project to work on. your concern will be highly appreciated 

Java Beginners

Java Programming - Java Beginners
Java Programming  To find out minimum and maximum numbers in an array   Hi Friend, Try the following code: public class... = num[i]; } } System.out.println("Smallest Number 

Java Beginners

JAVA PROGRAM - Java Beginners
JAVA PROGRAM  TO FIND OUT MINIMUM AND MAXIMUM NUMBERS IN AN ARRAY  Hi Friend, Try the following code: public class Find{ public...]; } } System.out.println("Smallest Number: "+min 

Java Beginners

arrays - Java Beginners
the largest and the smallest values in the group. ? Include a static method... of integer array o Finds the smallest value in the array, and o Returns the smallest... and the smallest values by using the above three methods. ? The program prints the largest 

Java Beginners

java - Java Beginners
cos(x)=1-x^2/2!+x^3/3!-x6/6!....... Q5- - write a program in java to find... in java to sum series?x+x^2+x^3+x^4+ ??..+x^n Q12 write a program in java...-conversion http://www.roseindia.net/java/beginners I hope this will help you 

Java Beginners

JAVA - Java Beginners
;Core Java Interview questionshttp://www.roseindia.net/interviewquestions... of a ClassIn Java Access Specifiers are keywords that give rights to access a class in different ways. Four types of Access Specifiers can be found in Java 

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 Beginners

java - Java Beginners
java  Write a java class program to draw a diagram for function f(x)=x2 (applet/application 

Java Beginners

div to scrollbar - Java Beginners
overflow:auto but it did not work. and now the only way is in java script so...(obj, x, y) { var theObj = getObject(obj); if (theObj... units = (typeof theObj.left == "string") ? "px" : 0 theObj.left = x 

Java Beginners

java - Java Beginners
://www.roseindia.net/java/beginners/StringTokenizing.shtmlamar...Java compiler and interpreter  is there any online Java compiler...); int x = Integer.parseInt(st.nextToken()); int y = Integer.parseInt 

Java Beginners

Java Code - Java Beginners
Java Code  Code a do while loop that continues executing until the value of a string variable named code is equal to ?X? or ?x?. Within the loop, display the prompt ?Enter a code or ?x? to exit: ?. Then, accept the value 

Java Beginners

Final Project - Java Beginners
in this class. Here is your assignment: You work for a Landscape architect. They have... the keyboard and click Ctrl+X. Third, the user can click on the red X at the top 

Software Services

PHP Outsourcing, PHP outsourcing work, PHP outsourcing india, Outsource PHP Development work in India
PHP Outsourcing - Outsource your PHP development work Outsource your PHP development work to us. We at Rose India Technologies Pvt. Ltd. is dedicated to work on our client's PHP projects. Outsource your PHP website and E-commerce 

Java Beginners

java; arrays - Java Beginners
java arrays example  How can you create a program, by using arrays and the output would be X. by using char or string.Thank you 

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 

Java Beginners

java - Java Beginners
in JAVA explain all with example and how does that example work. thanks  ... link: http://www.roseindia.net/java/beginners/arrayexamples... Search: http://www.roseindia.net/java/java-tips/algorithms/searching 

Java Beginners

java - Java Beginners
java   Hello, i have a text file having strings like "dab"; "daxyb"; "axb"; how to read this file and how to convert these strings into a character array. output like this:d a b d a x y b a x

Java Beginners

OOP - Java Beginners
/ http://www.roseindia.net/java/beginners/Construct.shtml Thanks... of the following classes:? A.) public class AA { private int x; private int y; public void print() { System.out.println(x + " " +y); } public int sum 

Java Beginners

class Math - Java Beginners
class Math  "Helo man&sir can you share or gave me a java code hope... the ceil(),floor(),and abs() methods to determine the smallest whole number... you: the smallest whole number>=to the number, the largest whole number< 

Java Beginners

Constructor - Java Beginners
for more information. http://www.roseindia.net/java/beginners/Construct.shtml... x,y; Constract(int a, int b){ x = a; y = b; } Constract(){ } int area(){ int ar = x*y; return(ar); } } public class 

Java Beginners

Algorithm_2 - Java Beginners
Sort,please visit the following link: http://roseindia.net/java/beginners... is S) into two disjoint groups L and R. L = { x Σ S ? {v} | x ≤ v} R = { x Σ S ? {v} | x > v} 4) Return 

Java Beginners

java beginners
java beginners  When an object is falling because of gravity...=input.nextDouble(); for(int x=1;x<11;x++){ System.out.println(df.format(fallingDistance(x 

Core Java

Multithreading Example In Java
Multithreading Example In Java In this section we will learn about multithreading in Java. Multithreading in Java is used to execute multiple tasks at the same time or parallel. Support of Multithreading in Java allows to process 

General

Determine Average by removing Largest and Smallest Number
Determine Average by removing Largest and Smallest Number In this section, you will learn how to remove largest and smallest number from the 10 numbers... and smallest number. Now to remove these highest and lowest numbers from the array, we have 

Java Beginners

Array in Java - Java Beginners
to smallest. For example: For the array -12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 

Java Beginners

java-io - Java Beginners
http://www.roseindia.net/java/beginners/SquareMatrix.shtml Thanks...java-io  Hi Deepak; down core java io using class in myn...(3,3); int x[][],y[][],z[][]; System.out.println("\n Enter First matrix 

Java Beginners

Java program - Java Beginners
Java program  Dear maam/Sir, I am a 2nd year Computer... not that familiar with java environment.. My friend told me that you can help me with my...="Water"; } int x = (1997 - year) % 12; if ((x == 1) || (x 

Java Beginners

java - Java Beginners
java  sir, I have not constructor overriding. if possible send example.  class q { int a,b; q() { a=0;b=0; } q(int x) { a=x; b=x; } q(int x,int y) { a=x; b=y; } public 

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... for the creation of objects. The primitive data type and keyword void is work 

Java Beginners

hi - Java Beginners
; Hi anjali, class ploy { public void ployTest(int x){ System.out.println("value of x: "+ x); } public void ployTest(int x, int y){ System.out.println("Value of x and y: " + x + " and " + y); } } public class 

Java Server Faces Questions

JSP Parse did not work - Java Server Faces Questions
 

Java Beginners

write program - Java Beginners
://www.roseindia.net/java/beginners/ Thanks...write program  write a java program that will read the values...[][] = {{6,4},{5,7},{1,1}}; int array2[][] = new int[3][3]; int x 

Java Beginners

java servlet - Java Beginners
java servlet  Hi Friends, I want to create a small web application using net Beans.My intention is to create a log in page,if the person doesnt have username , password then he use to create a username.For this i want 

Java Beginners

java code - Java Beginners
java code  how can get the intensity values of the image?how to divide the image into 8*8 blocks? (send me the implementation code in java) ...++) { for(int x=0;x<8;x++) { f=new CropImageFilter(tw*x,th*y,tw,th 

Java Beginners

Java - Java Beginners
Java  Code a do while loop that continues executing until the value of a string variable named code is equal to ?X? or ?x?. Within the loop, display the prompt ?Enter a code or ?x? to exit: ?. Then, accept the value of the code 

Java Beginners

JAVA - Java Beginners
JAVA  How to separate the string of any file name. Suppose I have the file named x_y_z.txt then I want to separate x,y & z independently.  ...{ public static void main(String[] args) { File f=new File("x_y_z.txt"); int 

Java Beginners

Java Compilation Error - Java Beginners
Java Compilation Error  hi, i'm chandrakanth.i got a dought.... chandrakanth.k class ExOnBasic3 { int x; int a; public static void main(String...(); System.out.println("x="+x); } void assign() { a=30; x=a; } };  Hi friend 

Java Beginners

core java - Java Beginners
BitWiseOpsTest { public static int add(int x, int y) { int xor, and, temp; and = x & y; xor = x ^ y; while(and != 0 ) { and <<= 1; temp = xor...://www.roseindia.net/java/ Thnaks. Amardeep 

Java Beginners

java program - Java Beginners
java program  "Helo man&sir can you share or gave me a java code hope... of x and y if x is greater than y;otherwise, it should return x minus 2 times y..." by adding the value of x to its previous value V. If the value of "z 

Java Beginners

java program - Java Beginners
java program  I have to make two radio buttons where one to show... jsp code: function show(){ document.getElementById('x').style.visibility='visible'; } function hide(){ document.getElementById('x 

Java Beginners

Java code - Java Beginners
Java code  Write a Java program that accepts 5 integers and sort them... Array4 { public static void main(String str[]) { int x[]=new int[5]; for(int i=0;ix[j]) { int t=x[i]; x[i]=x[j]; x[j]=t 

Java Beginners

Adding a text file - Java Beginners
Adding a text file  Hello, I need a program that will search a text file of strings representing numbers of type int and will write the largest and the smallest numbers to the screen. The file contains nothing but strings 

Java Beginners

Java programming 1 - Java Beginners
Java programming 1  Hi sir, i facing problem in this program.... Here are my question.. Write a program that will find the smallest... the data and output the values for the smallest mark, the biggest mark 

Java Beginners

Java - Java Beginners
ORIENTED PROGRAMMING) USING JAVA...JAVA CODES.WHAT SHOULD I CHOOSE BECAUSE I... and is popular in developing larger application. Another important work in OOP... of the problem, preparing a solution, coding and finally its maintenance. Java 

Java Beginners

Java basics - Java Beginners
how object/class/variable work. new to java. -Thanks javanewbie  ... to visit... http://www.roseindia.net/java/beginners/ Thanks...Java basics  I have two classes class cat { int height, weight 

Java Beginners

java - Java Beginners
. (each array element contains one digit) X[8]=4 x[7]=7 x[6]=9 ...... prompt 

Java Beginners

JOptionPane - Java Beginners
. This homework is concerned mainly with these two features of Java. Write a program that will find the smallest, the largest and the average value for a set... for the smallest mark, the biggest mark and the average of the set of marks. Both input 

Java Beginners

java - Java Beginners
; ) refurn p; } public static void main (String args []) { int X=4; System.out.println (fact (X)); )  Hi Friend, If you are trying to find... (String args []) { int X=4; System.out.println (fact (X)); } } Thanks 

Java Beginners

java - Java Beginners
java  Write a java applet to implement moving a ball from top... = box.getGraphics(); g.fillOval(x, y, XSIZE, YSIZE); g.dispose... = box.getGraphics(); g.setXORMode(box.getBackground()); g.fillOval(x, y, XSIZE, YSIZE 

Java Beginners

java thread - Java Beginners
Java Thread  What is thread in Java? and how can i write a Java...(); g.fillOval(x, y, XSIZE, YSIZE); g.dispose(); }   public void move...(box.getBackground()); g.fillOval(x, y, XSIZE, YSIZE); g.setColor(Color.green 

Java Beginners

java multi - Java Beginners
java multi  Q. 1. Write a class with a special member function... of zero‚??s present. Q.2. Write a program in java to input a sentence and find out the smallest word along with its position.(without using array & tokenizer key 

Java Beginners

java program - Java Beginners
java program  take the value of "A" then calculate and print the sum...)); System.out.println("Please enter number!"); double x = Double.parseDouble...; term = term * x / i; System.out.println(i + " " + term 

Java Beginners

Java programming 1 - Java Beginners
Java programming 1  hi there, Sir! Can u help me check where my...++) { if (numbers[i] < smallest) { smallest = numbers[i... = " "; for (int i = 0; i < numbers.length; i++) { output += "\nThe smallest 

Java Beginners

Inheritance and Composition - Java Beginners
==true) return("It bites! "); else return("It doesnt bite...") return("It bites! "); else return("It doesnt bite 

Java Beginners

Applet - Java Beginners
].x - 10, pt[i].y - 10, 20, 20... // tall thin triangles. g.drawLine(pt[0].x, pt[0].y, pt[1].x, pt[1].y); g.drawLine(pt[1].x, pt[1].y 

Java Beginners

java - Java Beginners
vehicle) class. The following kinds of inheritance are there in java... : class A { int x; int y; int get(int p, int q){ x=p; y=q; return(0); } void Show(){ System.out.println(x); } } class B 

Java Beginners

java - Java Beginners
java  if m required to determine if x is a perfect number hw do i go abt doing it   Hi friend, Use the following code: public class PerfectNumber{ public static void main(String[]args){ int x = 28; int 

Java Beginners

java - Java Beginners
java  What are Classes in JAVA. How it is related to structure in C... are created. A C structure is like a Java class that only contains public... that knows the declaration. For example: struct point { int x, y 

Java Beginners

java code - Java Beginners
java code  2x2 matrix multiplication code  Hi Friend, Here is the java code into which we have created two 2 x 2 Matrices array1[2][2...]; int x= array1.length; System.out.println("Matrix 1 : "); for(int 

Java Beginners

Java abstraction - Java Beginners
Java abstraction  what is abstraction in java please explain... { static int x, y; public CulculatePoint() { x = 10; y = 15; } public...; } public static void print() { System.out.println("point: " + x + "," + y 

Java Beginners

java - Java Beginners
in Java  Hi,To develop programming skills in java you must work hard and start learning.For start java programming you need:1.First required java... in the java binger tutorial.4.For more see the link http://www.roseindia.net/java/new 

Java Beginners

java - Java Beginners
java  write a java application to implement mouse events & display...(Component.RIGHT_ALIGNMENT); } public void update(int x, int y) { if (x < 0...; } if (point2 == null) { point2 = new Point(); } point2.x = x 

Java Beginners

java - Java Beginners
java  Hi guys, Thanks for your help to many... Please I need java codes to solve the following problems. 1. X2-y2 where x=sum of odd numbers from 1... java code to show the frequency of occurance of all the sides. Thank you all 

Struts Questions

Struts Login Validation. In This code setter of login page is called only one time again it doesnt call it. Why..?
Struts Login Validation. In This code setter of login page is called only one time again it doesnt call it. Why..?  **struts.xml** <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software 

Java Beginners

program - Java Beginners
program  take the value of x,y, and a then calculate and print the sum of the following series: x1/y2 + x2/y4 + x3/y6......20 terms.... actually the numbers after x and y are exponents...like x to the power 1 / y 

Java Beginners

Infix to Prefix - Java Beginners
; for (int i = 0; i < sb.length(); i++) { for (int x = 0; x < operators.length; x++) { int tempIndex = sb.indexOf(operators[x], i...) { index = tempIndex; operand = operators[x 

Advertisements Advertisements
 

 

 

DMCA.com