0

Primitive Operators Q1

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double pi = 3.14; int var = 4; double result = var * pi; System.out.printIn(result); } } My code as above but I can’t get the answer. Please help.

9th Mar 2021, 2:51 AM
Chin Eu
Chin Eu - avatar
2 Respuestas
+ 3
Did you notice that the Scanner object is imported at the top and there is a scanner class inside the code? It means you need to take input from the user. int var = scanner.nextInt(); https://www.sololearn.com/learn/Java/2220/ It's small 'L' not capital 'i' in println
9th Mar 2021, 3:14 AM
Simba
Simba - avatar
+ 1
Thank you Simba 👍🏼
9th Mar 2021, 8:05 AM
Chin Eu
Chin Eu - avatar