This channel is severely underrated. This man is doing God's work
@miguelbahena26033 жыл бұрын
no cap, he deserves more recognition
@katelynbradley94362 жыл бұрын
I agree this channel is so underrated!! Methods literally have brought me to tears and 1 video with this guy and it all makes sense. God bless you!!!
@baltarussow7573 Жыл бұрын
Did I miss something? What to do if the inputs have the same value? In this code the method returns the first input because of >= but that is not strictly correct in the context of the exercise? Love the tutorials by the way!
@mex95472 жыл бұрын
Cristal clear!!!
@timdjalalov86312 жыл бұрын
My method is written little bit differently, but works the same way, logic. public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a number between 1 and 100 : " ); int number1 = input.nextInt(); System.out.println("Enter a number between 1 and 100: " ); int number 2 = input.nextInt(); int answer = compareTwoNumbers(number1, number2); System.out.println("You entered the numbers " + number1 + " and " + number2 + " The larger number is: " + answer); } public static int compareTwoNumbers ( int a , int b){ if ( a > b) return a ; else return b; }
@arnodorian16203 ай бұрын
i hope you answer just started learning java and i wanna know why you put the value "1" on your 3 variables?
@KaisarAnvar2 жыл бұрын
This was mine, would this also be acceptable? Thank you. *public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter number between 1 and 100: "); int input1 = scan.nextInt(); System.out.println("Enter another number between 1 and 100: "); int input2 = scan.nextInt(); System.out.println("You entered the number " + input1 + " and " + input2 + ". The larger number is: " + largerNumber(input1, input2)); } public static int largerNumber(int a, int b){ int answer = Math.max(a, b); return answer; }*
@FitWithShamas2 жыл бұрын
watching this in 2022! great explanation
@AONK2 жыл бұрын
same, i can't believe this course is free
@kelvinshrivastav18586 жыл бұрын
Why we have assigned 1 to number1,number2 and largerNum?
@mahmoudali56235 жыл бұрын
its not neccsary he does it so that if someone puts a invalid number like a double the program ends instead of error
@mohamadserhal30465 жыл бұрын
Mahmoud ali bro I think he forgot something he should have wrote if number >0 &&