Welcome to Dream.In.Code
Become a Java Expert!

Join 150,427 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,077 people online right now. Registration is fast and FREE... Join Now!




Java Arrays of objects

 
Reply to this topicStart new topic

Java Arrays of objects, Understanding objects

chetah
15 Mar, 2008 - 01:20 AM
Post #1

D.I.C Head
**

Joined: 17 Nov, 2007
Posts: 61



Thanked: 1 times
My Contributions
Question Details:
CODE

//class declarations
class Account{
private int        accNum;
private double     balance;
  Transaction trans;

Account(int a, double b, String f, String l){
  accNum = a;
  balance = b;
   Transaction[]trans= new Transaction[10];
}

class Transaction{
private int accNum;
private String date;
   Transaction(int a, String d){
  accNum = a;
  date = d;
   }

Problem
I have two files, "accounts.txt" and "transaction.txt", I am trying to read the transaction data from the transaction file into the main Account.
//Code
Transaction[index].trans[i] = new Transaction(in.nextInt(), in.next());
index = position returned by binarysearch
//error : Transaction cannot be located, what might the problem be?


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:44PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month