Trouble using access functions in an array of objects
From: Aki Laukkanen (aki.laukkanenREMOVE_THIS_at_helsinki.fi)
Date: 05/31/04
- Next message: Andrew Thompson: "Re: Trouble using access functions in an array of objects"
- Previous message: Ryan Stewart: "Re: help needed on custom tag"
- Next in thread: Andrew Thompson: "Re: Trouble using access functions in an array of objects"
- Reply: Andrew Thompson: "Re: Trouble using access functions in an array of objects"
- Reply: Ryan Stewart: "Re: Trouble using access functions in an array of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 31 May 2004 16:14:57 +0300
Okay, here's what i've got stuck with this time:
I have an array of objects, and I want to set properties of each object
in the array using the objects' access function.
While doing this, i get a NullPointerException.
What am I doing wrong?
Example of the code:
class Member {
private long aValue;
public void SetAValue(long aValue){
this.aValue = aValue;
}
}
//The following is written in the main function of another class:
Member[] Members = new Member[10];
for(int i = 0; i < 10; i++){
Members[i].SetAValue(5);
}
-- -Aki "Sus" Laukkanen
- Next message: Andrew Thompson: "Re: Trouble using access functions in an array of objects"
- Previous message: Ryan Stewart: "Re: help needed on custom tag"
- Next in thread: Andrew Thompson: "Re: Trouble using access functions in an array of objects"
- Reply: Andrew Thompson: "Re: Trouble using access functions in an array of objects"
- Reply: Ryan Stewart: "Re: Trouble using access functions in an array of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|