File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Anybody who can translate following Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Anybody who can translate following Code" Watch "Anybody who can translate following Code" New topic
Author

Anybody who can translate following Code

thomas colding
Ranch Hand

Joined: Mar 23, 2007
Posts: 60
They are something that I do not understand, may I can get som help here.

I have following code lines that I do not understand, anybody Who can explain

EntriesTo[] newsEntriesTO= new EntriesTo[12];
newsEntriesTO[0].setLocation("location");


I am not allowed to set Location when I execute the Code, is not the Correct way

Following is the Class listed that I Instanciate.

public class EntriesTo extends TransferObject {
private String location = null;


public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}

}





Thanks in advance
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
You are creating an array that can hold 12 instances of 'EntriesTo'. That does not mean it is already filled with 12 fresh instances. That is up to you.



This is what you want.


JDBCSupport - An easy to use, light-weight JDBC framework -
thomas colding
Ranch Hand

Joined: Mar 23, 2007
Posts: 60
Sebastian Janisch wrote:You are creating an array that can hold 12 instances of 'EntriesTo'. That does not mean it is already filled with 12 fresh instances. That is up to you.



This is what you want.

But my array have to be dynamical


Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
In that case use a List. It's generally more advisable to use Lists over arrays.



As you can see it's far more flexible, as it can grow and shrink dynamically.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
"m iq" please read your private messages again.
 
jQuery in Action, 2nd edition
 
subject: Anybody who can translate following Code