Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

int cannot be dereferenced

807591Mar 9 2008 — edited Mar 9 2008
Hi! I keep getting this "int cannot be dereferenced" error msg all the time... Can you help me correct my codes please??

import java.io.*;
import java.util.*;

public class Q4
{
public static void main(String [] args)
{
try
{

Scanner sf=new Scanner(new FileReader("Input.txt"));

int x=1;
while (x.hasNext())
{
x=sf.nextInt();
System.out.print(x + " ");
}
}
catch (IOException e)
{
System.out.println("Input error");
}

}
}

Thanks a lot...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 6 2008
Added on Mar 9 2008
16 comments
320 views