Is there something wrong with the code? I keep getting errors?

I keep getting errors and it's quite annoying so is there something wrong with the code?

import java. util. Scanner;
public class cartesian {

public static void main (String[] args) {
Scanner car= new Scanner (System. in);
System. out. println ("insert 1st number");
int num1=car. nextInt ();
System. out. println ("insert 2nd number");
int num2=car. nextInt ();
System. out. println ("insert 3rd number");
int num3=car. nextInt ();
int max;
max=num1>num2?(num1>num3?:num1:num3):(num2>num3? num2:num3);
System. out. println (max+ "is the maximum");
}
}

thanks in advance

Updates:
for some reason a line in the code changed when I posted the question
max=num1>num2?(num1>num3?:num1:num3):(num2>num3? num2:num3);

0|0
0|2

What Guys Said 2

  • you should use something called eclipse. its a compiler that tells you what line your code becomes unreadable. so do that.

    0|0
    0|0
  • Did you debug , what kind of errors do you get? Logical errors?
    Not very familiar with java syntaxes so cannot help if error is in that.
    Also did you write 'max' or 'max+' in the last out statement.

    0|0
    0|0

What Girls Said 0

No girls shared opinions.

Loading...