Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Generics in Java!
You have completed Generics in Java!
Preview
In this video we'll learn how to use type parameters with functions!
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Let's see how to do that by writing
our own add method in the main class.
0:00
It'll take an item in the box, and
0:00
inside we'll print out what type of item
it is and then add the item to the box.
0:03
Also, since the main function is static,
we'll need our function to be static too.
0:09
Let's start at the bottom of
the class with the static keyword.
0:14
Then, before we get to any parameters,
0:19
let's finish out the basic
method structure.
0:21
Let's use void for the return type,
name the method debugAdd,
0:24
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up