Search:

Type: Posts; User: TSSF44

Search: Search took 0.12 seconds.

  1. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    I can't thank you enough Kewish. I need to start using the oracle docs more. VERY Helpful.


    Final answer:




    import java.io.*;
    import java.util.Scanner;
  2. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

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

    public class Chapter13 {

    public static void main(String[] args) {


    File object = new File(args[0]);
    int count =...
  3. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    Thank you.. I guess I was searching incorrectly. And I really thought I needed DataInputStream no matter what

    Anyway, I created a data.txt so that code would run, and nothing happened when I ran...
  4. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    Scanner sc = new Scanner(new File("test.txt"));
    DataInputStream binIn = new DataInputStream(new FileInputStream(args[0]));
    File object = new File(args[0]);
  5. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    An array args index 0? Sorry. I am just a beginner

    args[0] is what you enter on the command line?
  6. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    File takes a string in the constructor?


    the text file is passed as args[0]
  7. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    InputStream? Im reading through the whole Scanner class now
  8. Replies
    17
    Views
    1,392

    Re: File Processing- Command Line Arguments

    Thank you. Still trying to figure it out.

    to make a new file I would use
    Scanner sc = new Scanner(new File("myNumbers")); , but I thought I am supposed to specify the file in the command line?
  9. Replies
    17
    Views
    1,392

    File Processing- Command Line Arguments

    Here is the problem I am trying to solve:


    Write a program that determines and displays number of lines in a file that you specify on the command line. Example run:

    java YourClass test.txt
    12...
Results 1 to 9 of 9