• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Anybody who can translate following Code

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
thomas colding
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"m iq" please read your private messages again.
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic