I decided to create a currency converter in Java, and have it so that it would pull the conversion values out of a text file (to allow for easy editability since ... |
Hey guys this is a followup to my previous question. I now have a text file which is formatted like this:
100 200
123
124 123 145
What I want to do is get ... |
This is what I have so far but I don't now what to do next. The question is as follows (sorry the coding is not all appearing in one box):
Implement a ... |
Here's my code:
public void readFile() throws IOException {
System.out.println("Input file name: ");
Scanner in = new Scanner(System.in);
String readName = in.nextLine();
...
|
alright so I am trying to read a text file. and then split it up into lines which actually represent processes in a process table arraylist. then i want to split ... |
What I'm doing is storing classes into an ArrayList and retrieve them by its index number. But are there any list classes in Java where I can retrieve a list ... |
I'm trying to get each element on each line in a text file so I can perform calculations from line to line. The problem is that I'm only able to get ... |
|
The actual problem will be addressed a bit further down :), thanks.
I'm fairly new to Java (nearly through a 400 page book).
I'm not really that familiar with the API yet.
This ... |
I want to write an ArrayList into a text file. How to add "arr" ArrayList's item to a text file?
The ArrayList is created with the code:
ArrayList arr = new ArrayList();
StringTokenizer st ...
|
I have a text file that contains data that was saved using the cvs encryption and I want to open it in java and display it lined up perfectly. I have ... |
For my homework assignment, I'm supposed to create an ATM/Teller program which stores users accounts in a text file. I require help reading the text file and storing certain parts of ... |
Hi All, I have been able to store two strings (M44110|T33010, M92603|T10350) using ArrayList, which represent the result of some patient tests. Nevertheless, the order of these results have been stored correctly. E.g. currently stored in file Snomed-Codes as - [M44110|T33010, M92603|T10350][M44110|T33010, M92603|T10350] Should be stored and printed out as - M44110|T33010 M92603|T10350 Below is the detail of the source code ... |
Hello. I have written a program that uses an arraylist to store data. This data is inputted into a record and then the record is stored at each spot in the arraylist. Therefore, each spot in the arraylist contains a record with several types of data. What I need to do is read and write the arraylist so that the data ... |
|
Hi Mark I would use the Scanner as you have. But what exactly are you stuck on? If it is how to store them in an array list, I would create my own Object that held the 3 doubles in a way that represents what they are, then I would make the List a generic of that type of object and ... |
well, this is my main import java.io.*; import java.util.*; public class AIRTAXI{ public static void main(String [] args) throws FileNotFoundException { Scanner console = new Scanner(System.in); String inputFileName = "just.txt"; FileReader reader = new FileReader(inputFileName); Scanner in = new Scanner(reader); ArrayList information = new ArrayList(); while(in.hasNextLine()) { String line = in.nextLine(); int index = line.indexOf(","); while(index != 1){ String input1 = ... |
Hi, I'm trying to create a simple text editor, but I not sure how to use the method set_curr_line to change the current line int he buffer to a integer. Then it would print out the new current line. I need a push on how to do this. import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; import static java.lang.System.*; ... |
Hi all. hope this is the right place to post! My question is i have a text file with 10 lines, each line has different parts eg name, age, height etc, want i want to do is create an array so each line has its own array 'box' eg line one of the text file goes into array position 0 line ... |
Hi... I am new to java and I want some help. I want to join a text file with an ArrayList. I have the code that read line for line the text and saves it in the buffer. In the text there are two parts ("label" and "definition") it's a glossary. The program that I run now is reading the term ... |
import javax.swing.JFrame; import java.io.FileNotFoundException; import java.io.File; import java.io.PrintWriter; import java.util.*; public class StudentViewer { public static void main(String[] args) throws FileNotFoundException { File inputFile; File outputFile; if (args.length >= 1) { inputFile = new File(args[0]); //outputFile = new File(args[1]); AppliedStudent nameArray[] = inputFile; (This is wrong but I don't know how to correct it.) List names = Arrays.asList(nameArray); Collections.sort(names); System.out.println(names); JFrame ... |
Can someone show me a good way to take a text file(Email.txt) with name email information set up as Name Name@mail.com and feed this info into an arrayList ? The only thing that I can find in the books I have is ways to do it statically. The program must read all the pairs, construct an Info object for each, and ... |
|
Ah. Yes. That would be a typo. It's supposed t be greater-than-or-equal-to zero. As in.. infinitely. And its purpose is just to assign "i" a value as the lines are read. Fixing it didn't fix the problem I'm having though. but thanks for noticing that! You probably just saved me a lot of future grief. Edited by: alsuff on Mar 21, ... |
|
/* * DBKlass.java * * from file.io * a text file with blocks of data * "records" are 3-10 lines of text separated by blank-line-return * all lines read into an Arraylist klasList * file.io also added the micron character to any blank lines * * pass a loaded ArrayList which is a long line-for-line storage * of my file I ... |
|
oplead wrote: This writes the numbers in one straight line. I don't know where to include "\n" to do this the right way. Any hints on how to do this? Thanks Huh? You've done the hard bit, and you can't (even by trial and error) workout where to put the newLine? I suggest you study flounders response (above) and desk-check your ... |
|
|
i have been given the task to; 1) Create an ArrayList CurrentAccounts of BankAccount object, 2) Initialising the elements of this array using the given data. I have a class with all the deposit, withdrawal accName and numbers etc fields. The given data is in the format 1/J.Blogs/0015-152/155.76/200 1/name/accNumber/balance/overdraftLimit / - is the delimiter I must use the Scanner class How ... |
I think you may be confused about something. There are two types of streams in Java: binary and text. You mentioned wanting to write to a "text" file which implies to me that you want the result to be a file of text! ObjectOutputStream writes binary data which will not be human readable text. You could certainly solve your problem either ... |
|
|
|
|
|
You might want to consider whether you really need to read the entire file into memory to do whatever it is you're doing with the data. If you do, you might also want to consider whether you can process each line before storing it. For example, if each log line has a couple dozen characters describing a time/date, you could parse ... |
|