Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 19
● U need to create only 1 Scanner object & use its .nextInt() method multiple times 👍[can use other methods also, but only 1 object in sufficient] //here is corrected code : import java.util.Scanner; public class Program { static int min(int a,int b) { if(a>b) { return b; } else { return a; } } public static void main(String[] args) { int a; int b; Scanner der=new Scanner(; a=der.nextInt(); b=der.nextInt(); System.out.println(min(a,b)); } }
28th Dec 2018, 3:03 PM
Gaurav Agrawal
Gaurav Agrawal - avatar