• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Methods & Arguments

 
Bryan Snipes
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"j Rookie", please check your private messages. You can see them by clicking My Private Messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic