• Post Reply Bookmark Topic Watch Topic
  • New Topic

printAL question  RSS feed

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is from page 163 of Head First Java.  I don't understand what is happening with public static void printAL(ArrayList<String> al).  I've never seen printAL and am not sure
if the code is just creating that or if it's part of the java.util library. Overall I'm not sure what it means or is happening as I've never seen a static void line similar to that. Just looking to understand what is happening. 

Thanks for any explanation.

 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is the start of a method declaration. What it says is "I am declaring a method named printAL with a single parameter of type String. The method should be treated as public and as static, and it doesn't return a value (that's what void means)."

So yes, the code is creating that method. It's not part of the standard Java API because you don't need to declare those things in your code, they are already declared in somebody else's code.

In Head First Java there should be a description of what it means to declare a method; you may have already passed over that and not absorbed it or not noticed it. So look around in the book, maybe look in the index for "method declaration" or some form of those two words.
 
Brian King
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much. I appreciate it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!