• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Anybody who can translate following Code

 
Ranch Hand
Posts: 64
  • 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: 64
  • 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: 76397
364
  • 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.
 
Skool. Stay in. Smartness. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic