Arg... Guys can you correct my code?
'coz it gives me a wrong output if i input "3 , 1, 2 or 1, 3, 2 or 3, 2 ,1"

import javax.swing.*;

public class OutputGreatest
{
	public static void main(String[] args)
	{
		
		
		int uInput1,uInput2,uInput3;
		int maxValue;
		
		uInput1	= Integer.parseInt(JOptionPane.showInputDialog(null,"<1>Input a number : "));
		uInput2	= Integer.parseInt(JOptionPane.showInputDialog(null,"<2>Input a number : "));
		uInput3	= Integer.parseInt(JOptionPane.showInputDialog(null,"<3>Input a number : "));
		

				
		maxValue = (uInput1 > uInput2 || uInput1 > uInput3)? +uInput1: +uInput2;
	
		maxValue = (uInput2 > uInput1 || uInput2 > uInput3)? +uInput2: +uInput1;
		
		maxValue = (uInput3 > uInput1 || uInput3 > uInput2)? +uInput3: +uInput2;
		
		
		JOptionPane.showMessageDialog(null,"Greatest value is: "+maxValue );
		System.exit(0);
	}
	
}

It should be && instead of ||
And why do you use the + It is not necessary.
Also you don't need this:

(uInput1 > uInput2 || uInput1 > uInput3)? +uInput1: +uInput2

If the uInput1 is not the max, then why do you assume that the uInput2 is the max?
Use simple if-else if-else statements

Hey!, Thank you for your help.
I solved it in an instant, your so cool.

maxValue=(uInput2>uInput1 && uInput2>uInput3)? uInput2: (uInput3>uInput1 && uInput3>uInput2)? uInput3: uInput1;

-----
Mark as solved.

Edited 6 Years Ago by DoEds: n/a

This question has already been answered. Start a new discussion instead.