here's my code : I tried both of code in comments and after comment.
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
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);
System.out.println(max(a,b,c,d));
}
//if (((a>b)&&(a>c))&&(a>d)){
//System.out.println(a);
//}
//else if (((c>b)&&(c>a))&&(c>d)){
//System.out.println(c);
//}
//else if (((b>a)&&(b>c))&&(b>d)){
//System.out.println(b);
//}
//else if (((d>b)&&(d>c))&&(d>a)){
//System.out.println(d);
//}
public static int max(int a, int b){
return a>b ? a : b;
}
public static int max(int a, int b, int c, int d){
int p = max(a>d);
int q = max(c>d);
return p>q ? p : q;
}
}
package com.codegym.task.task04.task0419;
/*
Maximum of four numbers
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
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);
System.out.println(max(a,b,c,d));
}
//if (((a>b)&&(a>c))&&(a>d)){
//System.out.println(a);
//}
//else if (((c>b)&&(c>a))&&(c>d)){
//System.out.println(c);
//}
//else if (((b>a)&&(b>c))&&(b>d)){
//System.out.println(b);
//}
//else if (((d>b)&&(d>c))&&(d>a)){
//System.out.println(d);
//}
public static int max(int a, int b){
return a>b ? a : b;
}
public static int max(int a, int b, int c, int d){
int p = max(a>d);
int q = max(c>d);
return p>q ? p : q;
}
}