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

6th Jan 2018, 8:40 PM
Grey King
Grey  King - avatar
14 Antworten
+ 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!!!
7th Jan 2018, 9:32 AM
Grey King
Grey  King - avatar
+ 1
can you explain pls?
6th Jan 2018, 8:45 PM
Grey King
Grey  King - avatar
+ 1
how I can repair it? it's first code, and I can't catch it
6th Jan 2018, 8:50 PM
Grey King
Grey  King - avatar
6th Jan 2018, 8:56 PM
Grey King
Grey  King - avatar
+ 1
Scanner scan without dot
6th Jan 2018, 10:48 PM
Нурлыбек Орынбеков
Нурлыбек Орынбеков - avatar
+ 1
it doesn't work :( now problem with interface or class
7th Jan 2018, 5:04 AM
Grey King
Grey  King - avatar
+ 1
hm..it doesn't works (
7th Jan 2018, 9:12 AM
Grey King
Grey  King - avatar
+ 1
again wrong answer. don't work (
7th Jan 2018, 9:13 AM
Grey King
Grey  King - avatar
+ 1
but if you need use more than once, use Scanner variable "Scanner sc = new Scanner(System.in)"
7th Jan 2018, 9:38 AM
Нурлыбек Орынбеков
Нурлыбек Орынбеков - avatar
7th Jan 2018, 9:41 AM
Нурлыбек Орынбеков
Нурлыбек Орынбеков - avatar
+ 1
what difference with :"Scanner sc=new.Scanner (sustem.in)" and " int n=new.Scanner (system.in)"? Print words or numeral?
7th Jan 2018, 9:45 AM
Grey King
Grey  King - avatar
+ 1
your program print phrases
7th Jan 2018, 9:46 AM
Grey King
Grey  King - avatar
+ 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()"
7th Jan 2018, 9:50 AM
Нурлыбек Орынбеков
Нурлыбек Орынбеков - avatar
+ 1
I see thanks! )
7th Jan 2018, 11:56 AM
Grey King
Grey  King - avatar