Проверил порядка сотни вариантов и всё работает. Но третий пункт - всё ругается.
Не откажите в объяснении, что не так я делаю?
Не нужен готовый код, да и вообще код. Хочу именно понять, что не так в моем коде.
"например - где-то слышал, что нельзя пользоваться "return" в таких ситуациях.." потому ли не проходит?
помогите, други :)
package com.javarush.task.task04.task0419;
/*
Максимум четырех чисел
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String aa = reader.readLine();
String bb = reader.readLine();
String cc = reader.readLine();
String dd = reader.readLine();
int a = Integer.parseInt(aa);
int b = Integer.parseInt(bb);
int c = Integer.parseInt(cc);
int d = Integer.parseInt(dd);
if (a >= b && c >= d ) {
if (a >= c) System.out.println(a);
else System.out.println(c);
return;
}
if (a <= b && c <= d ) {
if (b <= d) System.out.println(d);
else System.out.println(b);
return;
}
if (a >= b && c <= d ) {
if (a >= d) System.out.println(a);
else System.out.println(d);
return;
}
if (a <= b && c >= d ) {
if (b >= c) System.out.println(c);
else System.out.println(b);
return;
}
if (a >= b && c >= d ) {
if (a >= c) System.out.println(a);
else System.out.println(c);
return;
}
}
}