0
Hi Everyone! I'm trying to create a Time converter that converts Days into seconds, and the error says "line 0 ";" expected"
Here is my code import java.util Scanner; public class Program { public static void main(String[] args) { Scanner days = new Scanner(System.in); Scanner scanner = new Scanner(System.in); int days = scanner.nextInt(); int daysToSeconds = days * 24 * 60 * 60; System.out.println(daysToSeconds); } }
3 ответов
+ 2
No need 2 scanners. Only 1 Scanner is enough. It's error there for creating 2 objects.
Remove days object because you again using for creating a variable..
You forgot a dot in java.util.Scanner; (you have space remove it)
Yes. Share your original code which you trying in code playground that helps you find mistakes accurately, easily..
+ 1
Can you share the original code, it makes it a bit easier to look at
+ 1
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int days = scanner.nextInt();
//your code goes here
int hours = days*24;
int minute = hours*60;
int seconds = minute*60;
System.out.println (seconds);
}
}
May this help you its more efficient for understanding