0

Is there anything wrong

import java.util.Scanner; public class Program { public static void main(String[] args) { String f; double a,b,c; Scanner d=new Scanner(System.in); Scanner e=new Scanner(System.in); a= d.nextInt(); b= e.nextInt(); c=b/0.02; f=(a>b)? "Dollars" : "Pesos"; System.out.println(f); } } Is there anything wrong? I can’t find out

14th Apr 2020, 1:47 PM
Zhengrong Yan
Zhengrong Yan - avatar
2 Answers
+ 2
Why two objects for Scanner objects..? No need and not allowed here.... You can use one object through out method.. By declaring class level, you can use in entire class......
14th Apr 2020, 1:59 PM
Jayakrishna 🇼🇳