File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes cannot get the info from disk file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot get the info from disk file" Watch "cannot get the info from disk file" New topic

cannot get the info from disk file

vincent donald

Joined: Sep 09, 2010
Posts: 10
this code that i have writen here does'nt want to collect my data from the file.I am still a beginner in java.If someone can give me some help?

import java.util.Scanner;

public class importDataProcess {

* @param args the command line arguments
public static void main(String[] args) throws FileNotFoundException {

String name;
int testValues;

Scanner diskScanner =
new Scanner(new File("C:\\testdata.text"));

name = diskScanner.nextLine();
testValues = diskScanner.nextInt();

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

So, what happens? Does the code compile? Do you get a runtime error (if so, what?) Does it simply not do what you expect? Please let us know, and we'll be better able to help you.

[Jess in Action][AskingGoodQuestions]
Cody Long
Ranch Hand

Joined: Jan 01, 2009
Posts: 95
In the future please put your code in code tags. Your code will be much more readable, and people will be more inclined to help you. Sorry, i do not know the answer. It has been a while since i have done stuff with reading files and the like.

Duct tape is like the Force. It has a dark side, a light side, and it binds the whole universe together.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20269

vincent donald wrote:this code that i have writen here does'nt want to collect my data from the file.

ItDoesntWorkIsUseless. What does it do instead? And what's the contents of the file? Please TellTheDetails.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: cannot get the info from disk file
It's not a secret anymore!