Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects Harnessing the Power of Objects Filling the Dispenser

Parameters

How do I know if I need parameters in my method??

1 Answer

Balazs Peak
Balazs Peak
46,160 Points

Does it need an input or not?

I could write a method which prints "Hello Student!" to the screen. In that case, there is no need for parameters.

But... what if I want to print "Hello Dylan!", when you are there, and the exact name for anyone else? In that case, the method will be constructed in a way that there will be a (string name) parameter passed which we can use.

Keep up the good work! Much love!