[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Adding new objects to Vector

public static void main(String [] args)
// The empty vector that will be used to store accounts
Vector accountVector = new Vector();

// New class methods
// public is missing so that it can remain in this file.
class inOut
      private static String line;
      private static String txtFileIn = "account.txt";
      static BufferedReader a = null;
      static StringTokenizer theStrings;
      static boolean done = false;

      public static void readInAccounts(Vector accountVector)
            // reads text file for input
                  FileInputStream b = new FileInputStream(txtFileIn);
                  a = new BufferedReader(new InputStreamReader(b));

            // exceptions omitted
                line = a.readLine()

Will this line of thought add the current line being read in a file as an object in a vector?

If not how should I be thinking?
1 Solution
yes, it will read the first line of the file
use a loop if you'd like to read more

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now