#Write a method which takes String parameters and returns an ArrayList

30 messages · Page 1 of 1 (latest)

sterile fjord
#

Problem shown in picture, "write a method" part is throwing me. Is it just supposed to be:
String first = "first";
...
ArrayList<String> littleList = new ArrayList<>();
littleList.add(first);
?

cunning pewterBOT
#

Hey, @sterile fjord!
Please remember to /close this post once your question has been answered!

#

<@&765578700724371486>

Requested by 6soup#4570
sterile fjord
#

Have an exam on this in 3 hours btw, other class starts in 2

sterile fjord
#

@plucky olive are you able to help with this ?

plucky olive
#

What have you trued so far?

#

or what is the problem?

#

Do you know what methods are?

sterile fjord
#

Right now no

#

Tired, burnt out

#

Usually when I do something with a method it's just type one thing, click red light bulb, have intelliJ generate it for me then type more

#

Tried this earlier:
String first = "first";
...
ArrayList<String> littleList = new ArrayList<>();
littleList.add(first);

#

Few other things too but I can't remember them

#

@woven fossil

#

Is private static .. to the } all the method

#

Or is it just the top line from private to {

woven fossil
#

Wut the

#

Wdym the "}"

#

You mean methods?

sterile fjord
#

Main issue that started my confusion was the "focus on the header"

sterile fjord
#

Got focused on the rest of it and forgot it said that but was fixated on that point of it

woven fossil
#

Im not sure what part of it that you don't understand

sterile fjord
#

Header

#

"Private static pill..."

#

Usually don't write them, just write the stuff in them and let intelliJ make the headers if it wants to

woven fossil
#

Private means that method is only Useable in that class, static means that method is a static method ( This need google because explain it gonna take a bit of times ), pill is the class name

thick nova
#

Public ArrayList<> littleList(String example1, String example2, String example3) { I think this is what its asking, could be wrong? Im learning still too

woven fossil