The Artima Developer Community
Sponsored Link

Java Answers Forum
please help! Why not compiling

1 reply on 1 page. Most recent reply: Feb 9, 2004 5:50 AM by twc

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Md. Anisuzzaman Khan

Posts: 1
Nickname: piasbd
Registered: Feb, 2004

please help! Why not compiling Posted: Feb 8, 2004 8:19 PM
Reply to this message Reply
Advertisement
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) ;// convert inData to int

if ( num < 0 ) // is num less than zero?
System.out.println("The number " + num + " is negative"); // true-branch
else
System.out.println("The number " + num + " is positive"); // false-branch

System.out.println("Good-bye for now"); // always executed
}
}



Giving the error:
symbol : method parseInt (java.lang.String)
location: class Integer
num = Integer.parseInt (inData) ;// convert inData to int
^
1 error

Please why

Thanks


__________________
Anisuzzaman Khan


twc

Posts: 129
Nickname: twc
Registered: Feb, 2004

Re: please help! Why not compiling Posted: Feb 9, 2004 5:50 AM
Reply to this message Reply
It compiled and ran fine for me.

Flat View: This topic has 1 reply on 1 page
Topic: call by value??? Previous Topic   Next Topic Topic: JVM v. JRE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use