+ 1
HI all! Help pls with my first program in JAVA!
Pls, tell me it's repairable? I can't understand ( import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner.scan = new Scanner(System.in); System.out.println(" Enter your age () "); int number = scan.nextInt(); int x = 360; int y = 8640; int z = 518400; int q = 31104000; int a = x*number; int b = y*number; int c = z*number; int d = q*number; System.out.println("days"+a/"hours"+b/"minutes"+c/"seconds"+c); } }
14 Answers
+ 2
import java.util.Scanner;
public class GreyProgram{
public static void main(String[] args){
int n=(new Scanner(System.in)).nextInt();
System.out.print("Your age in days : " + n*360);
{System.out.print(" Yor age in hours : " + n*8640);
{System.out.print(" Yor age in minutes : " + n*518400);
{System.out.print(" Yor age in seconds : " + n*31104000); } } } }
}
Yes!!! it's work!!!
+ 1
can you explain pls?
+ 1
how I can repair it? it's first code, and I can't catch it
+ 1
Scanner scan without dot
+ 1
it doesn't work :( now problem with interface or class
+ 1
hm..it doesn't works (
+ 1
again wrong answer. don't work (
+ 1
but if you need use more than once, use Scanner variable "Scanner sc = new Scanner(System.in)"
+ 1
what difference with :"Scanner sc=new.Scanner (sustem.in)" and " int n=new.Scanner (system.in)"? Print words or numeral?
+ 1
your program print phrases
+ 1
change method to nextInt(). Scanner have some methotds.
Used Scanner sc shorter when there is a lot of code.
example,
"int n = sc.nextInt()"
+ 1
I see thanks! )