Learn Java - Exercise 02x - Passing Parameters to a Method & Returning Values

  Рет қаралды 18,042

Math and Science

Math and Science

Күн бұрын

Пікірлер: 15
@NgolaNalane
@NgolaNalane 5 жыл бұрын
This channel is severely underrated. This man is doing God's work
@miguelbahena2603
@miguelbahena2603 3 жыл бұрын
no cap, he deserves more recognition
@katelynbradley9436
@katelynbradley9436 2 жыл бұрын
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
@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!
@mex9547
@mex9547 2 жыл бұрын
Cristal clear!!!
@timdjalalov8631
@timdjalalov8631 2 жыл бұрын
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; }
@arnodorian1620
@arnodorian1620 3 ай бұрын
i hope you answer just started learning java and i wanna know why you put the value "1" on your 3 variables?
@KaisarAnvar
@KaisarAnvar 2 жыл бұрын
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; }*
@FitWithShamas
@FitWithShamas 2 жыл бұрын
watching this in 2022! great explanation
@AONK
@AONK 2 жыл бұрын
same, i can't believe this course is free
@kelvinshrivastav1858
@kelvinshrivastav1858 6 жыл бұрын
Why we have assigned 1 to number1,number2 and largerNum?
@mahmoudali5623
@mahmoudali5623 5 жыл бұрын
its not neccsary he does it so that if someone puts a invalid number like a double the program ends instead of error
@mohamadserhal3046
@mohamadserhal3046 5 жыл бұрын
Mahmoud ali bro I think he forgot something he should have wrote if number >0 &&
@JAYCPRUDZ
@JAYCPRUDZ 5 жыл бұрын
Number 1 instructor
Learn Java - Exercise 02y - Java Method Parameters and Return Values
6:21
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Learn Java in One Video - 15-minute Crash Course
14:54
Coding with John
Рет қаралды 809 М.
Java Programming Tutorial - 01 - Introduction To Methods
20:21
Math and Science
Рет қаралды 173 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 581 М.
Return Statement in Java #27
14:38
Alex Lee
Рет қаралды 286 М.
How a Russian student invented a faster multiplication method
18:48
Java Programming Tutorial 09 - Class Methods with Parameters
10:32
Math and Science
Рет қаралды 32 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 648 М.
Java Programming Tutorial - 10 - Adding a Constructor to a Class
16:47
Math and Science
Рет қаралды 46 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН