• 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

cannot get the info from disk file

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
import java.io.File;
import java.io.FileNotFoundException;

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();
}


}
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic