0

So I have this code here:

List<XMLMessage> xmlMessageList = new ArrayList<XMLMessage>();

now XMLMessage has set and get methods in here such as setFileContent, setFileName, and setFileDirectory and these are all Strings.

So how do I access those setmethods?

I am guessing it's something like this?

List xmlMessageList = new ArrayList(); xmlMessageList.add(setFileContent);

SupaHotFire
  • 93
  • 1
  • 2
  • 4

1 Answers1

0

You can access a specific XMLMessage from the list by using the get get(int) method. You can then call methods on this instance. E.g.:

List<XMLMessage> xmlMessageList = new ArrayList<>();
xmlMessageList.add(new XMLMessage());

XMLMessageList.get(0).setFileName("my_file.txt");
Mureinik
  • 297,002
  • 52
  • 306
  • 350