java - Running a scanner program -
i trying write program read integer 1,000 999,999 , display comma separating thousands. far have this, , eclipse doesn't it. why?
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* name of class has "main" if class public. */ class ideone { public static void main (string[] args) throws java.lang.exception { // scanner scan = new scanner(system.in); double value, integer; system.out.println("enter value without comma"); integer = scan.nextdouble(); system.out.println(integer,); scan.close();
you have lot of errors in code why eclipse doesnt ;)
to name few:
- new scanner -> scanner capital s
- system.in -> same system
check out snippet below , run fine :)
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* name of class has "main" if class public. */ class ideone { public static void main(string[] args) throws java.lang.exception { scanner scan = new scanner(system.in); double value, intvalue; system.out.println("enter value without comma"); intvalue = scan.nextdouble(); system.out.println(intvalue); scan.close(); }
Comments
Post a Comment