• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HELP! Why not Compiling ? Easy but.......

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.io.*;
class NumberTester{
public static void main(String args[]) throws IOException
{
BufferedReader stdin = new BufferedReader ( new InputStreamReader(System.in ) );
String inData ;
int num ;
System.out.println("Enter an integer:");
inData = stdin.readLine() ;
num = Integer.parseInt (inData) ;
if ( num < 0 )
System.out.println("The number " + num + " is negative");
else
System.out.println("The number " + num + " is positive");
System.out.println("Good-bye for now");
}
}
Giving the error:
symbol : method parseInt (java.lang.String)
location: class Integer
num = Integer.parseInt (inData) ;
1 error
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It compiled and ran just fine for me.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question: if it's so easy and you know it why do you need help with it?
 
Md Anisuzzaman Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It compiles through j2sdk1.4.0 but not for j2sdk1.4.2 Surprisingly!!!
Thanks
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
compiles under 1.4.2_02 under Linux.
compiles under 1.4.2.b28 under Windows as well.
reply
    Bookmark Topic Watch Topic
  • New Topic