What does java do? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 3

What does java do?

what does java do like i cant do anything with that i find this code and do nothing whyyyy 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 sec = days * 24 * 60 * 60; System.out.println(sec); } }

29th Mar 2024, 10:55 AM
Tyler Banks
Tyler Banks - avatar
7 Respuestas
+ 2
It seems you joined the Web Development course only. And to my knowledge, Java is not covered in that course. The code you "found" is valid. If you are interested in Java, you can start with the Introduction to Java course.
29th Mar 2024, 2:17 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
Alberto Iannucci thanks bro 😊
30th Mar 2024, 12:23 AM
Tyler Banks
Tyler Banks - avatar
+ 2
Anoryne Wafula thanks bro:)
30th Mar 2024, 9:40 PM
Tyler Banks
Tyler Banks - avatar
+ 1
this code seems to be okay...
29th Mar 2024, 11:23 AM
Mihaly Nyilas
Mihaly Nyilas - avatar
+ 1
This code takes an input(days) and print the number of seconds. e.g: when you give a input 1 day it returns the total numbers of seconds in that number of day. It multiplies the number of day with 24 hours and then convert it to 60 minutes and then convert it to seconds.
29th Mar 2024, 2:01 PM
Ayush
Ayush - avatar
+ 1
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the number of days: "); int days = scanner.nextInt(); int sec = days * 24 * 60 * 60; System.out.println("The number of seconds in " + days + " days is: " + sec + " seconds"); scanner.close(); // Close the scanner to prevent resource leaks } } With this code, when you run the program, it will prompt you to enter the number of days. Once you enter the number and press “Enter,” the program will calculate the total number of seconds corresponding to the input days and print it to the screen. Make sure to enter an integer when prompted, otherwise the program might throw errors. After entering the number of days and pressing “Enter,” you should see the corresponding result in seconds printed to the screen.
29th Mar 2024, 5:00 PM
Alberto Iannucci
+ 1
Java is an object oriented programming language used to do the following: building desktop applications. Building mobile Android applications. You could as well learn it as a general-purpose programming language If you want to work on large enterprise software applications, then java is good for you.
30th Mar 2024, 7:52 PM
Anoryne Wafula
Anoryne Wafula - avatar