-
Where the problem inside code... Please help
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks