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); } }

30th Nov 2020, 8:26 AM
Bryle Macasuhot
Bryle Macasuhot - avatar
3 odpowiedzi
+ 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..
30th Nov 2020, 10:40 AM
Jayakrishna 🇮🇳
+ 1
Can you share the original code, it makes it a bit easier to look at
30th Nov 2020, 8:51 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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
9th Mar 2021, 2:13 AM
Rahfi
Rahfi - avatar