0

Guys what's the problem they said class expected

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int price = scanner.nextInt(); //complete the code int price = 12000; if(int price <= 12000){ System .out.println ("yess"); } } }

6th Jun 2022, 10:16 AM
MR KINGSHOW
MR KINGSHOW - avatar
1 ответ
+ 2
You're declaring the price variable too much. What's the purpose of having the user declare a price and then reassigning it right after? Also, you do not have to state the data type again once the price is declared. So it should just be if(price <= 12000)
6th Jun 2022, 10:26 AM
Justice
Justice - avatar