I've written up my code and ive tried adding in an array but i keep on getting errors. Can someone help please?
I want the fields to be in corresponding arrays.
Again, you've not told us anything we can use to help you--are you getting an error? If so, what code is producing it? Do you just not know where/how to start? Please TellTheDetails, and remember that ItDoesntWorkIsUseless. Thanks!
Why are you using character arrays instead of strings? Oooohh.... I think I see....
Creating an object that consists of all character arrays is not the same as creating an array of objects.
I would still get rid of the empty constructor,
and then if you want to create an array of books, you can declare an ArrayList.
And this:
Doesn't do what you think it does.... I'm pretty sure.
Say in words what you're trying to do and maybe we can help you more.
Vianna Dublin
Greenhorn
Joined: Mar 07, 2010
Posts: 6
posted
0
The no-arg constructor is supposed to be there. This is my appended code. The user should be able to input the amount of data to fill the fields how many times they want. They should also be able to view the data that they entered. Here is the appended code. Thanks
Baiju Scariah
Ranch Hand
Joined: Mar 17, 2005
Posts: 33
posted
0
Book books[] = new Book; --> Is just an array reference, you haven't created object yet.
Thus before assigning any value you must say
for(int i....)
{
books[i] = new Book();
}
Vianna Dublin
Greenhorn
Joined: Mar 07, 2010
Posts: 6
posted
0
So you mean like this? I'm still having a problem with the object though.
}
Christian Dillinger
Ranch Hand
Joined: Jul 20, 2009
Posts: 172
posted
0
You did not define an Array of Book. Does every book have the same title, the same title, the same isbn? Why are those fields static? Do you understand what "static" means?
Vianna Dublin
Greenhorn
Joined: Mar 07, 2010
Posts: 6
posted
0
I was using eclipse to program and as one of the suggested solution to the errors was to put in static.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.