Добрый день. Подскажите в чем у меня ошибка?
это мой код:
package com.javarush.task.pro.task03.task0305;
import java.util.Scanner;
public class Solution
{
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
String name = console.nextLine();
int x = console.nextInt();
int y = console.nextInt();
int z = console.nextInt();
if (x == y && x == z)
{
System.out.println(x + " " + y + " " + z);
}
else if (x == y)
{
System.out.println(x + " " + y);
}
else if (x == z)
{
System.out.println(x + " " + z);
}
else if (y == z)
{
System.out.println(y + " " + z);
}
}
}
А это код правильного решения
package com.javarush.task.pro.task03.task0305;
import java.util.Scanner;
/*
Три числа
*/
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int number1 = scanner.nextInt();
int number2 = scanner.nextInt();
int number3 = scanner.nextInt();
if (number1 == number2 && number1 == number3) {
System.out.println(number1 + " " + number2 + " " + number3);
} else if (number1 == number2) {
System.out.println(number1 + " " + number2);
} else if (number1 == number3) {
System.out.println(number1 + " " + number3);
} else if (number2 == number3) {
System.out.println(number2 + " " + number3);
}
}
}
Спасибо разобрался. А ошибка простая глупость и не внимательносить...
Заранее спасибоpackage com.javarush.task.pro.task03.task0305;
import java.util.Scanner;
public class Solution
{
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
String name = console.nextLine();
int x = console.nextInt();
int y = console.nextInt();
int z = console.nextInt();
if (x == y && x == z)
{
System.out.println(x + " " + y + " " + z);
}
else if (x == y)
{
System.out.println(x + " " + y);
}
else if (x == z)
{
System.out.println(x + " " + z);
}
else if (y == z)
{
System.out.println(y + " " + z);
}
}
}