0
Drawing Class Practice, in Control Flow in Intro to Java
Could someone help me figure out what is wrong with my code? For some reason I am not getting any output. import java.util.Scanner; public class Program { public static void main(int[] args) { Scanner myObj = new Scanner(System.in); int students = myObj.nextInt(); int pencils = myObj.nextInt(); System.out.println("Total:", students * pencils); } }
1 Respuesta
+ 2
code have No Main method . For main method need String array as argument. Not int array.
Next print statement : correct way is
System.out.println( "Total: "+(students * pencils) ) ;