| Author |
Methods & Arguments
|
Bryan Snipes
Greenhorn
Joined: May 09, 2008
Posts: 4
|
|
Hello everyone... I am just beginning to learn Java thru online courses. My first question (of many!) is what is the (Shirt s) in the code below? I understand that this method is accepting parameters from another class. But I don't understand what the "Shirt" is... the course said the "s" is the parameter.
|
 |
Richard Chambers
Ranch Hand
Joined: Apr 03, 2008
Posts: 40
|
|
Shirt is the type of "s" If you program is dealing with a closet, you'd have Shirts, Pants, Coats, etc... "s" in this case would be how many of the type. Hope this helps, btw, I'm struggling to finish my first semester JAVA class too, so others will have more clarification or correction for me I'm sure.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
Welcome to the Ranch. Not quite, Richard. You are correct that the type of the parameter is Shirt, but the "s" is what you are calling it in the method you are writing. The official term is the identifier for that parameter.
|
 |
Bill Shirley
Ranch Hand
Joined: Nov 08, 2007
Posts: 457
|
|
not only is Shirt a type, it's very likely a class, and will very likely be defined in another file, very likely called Shirt.java, with some code similar to
|
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
|
"j Rookie", please check your private messages. You can see them by clicking My Private Messages.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Methods & Arguments
|
|
|