Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how class name parameter works?  RSS feed

 
Biran Quach
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
part of my homework is
Static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively.
MyInteger is the class name. Can anyone explain how class name parameter works? i have no idea what it does.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that you pass an instance of the class to the method.

No different, for example, than a method that expects an instance of String.
 
Junilu Lacar
Sheriff
Posts: 11146
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Biran Quach wrote:part of my homework is
Static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively.
MyInteger is the class name. Can anyone explain how class name parameter works? i have no idea what it does.


What exactly do you mean by "class name parameters"?

Do you want to know about Java methods and method parameters? Then follow the link. Also, was there not some kind of discussion in your class lectures about this? And do you not have any books that you're using in this class? What have you read in your book / notes that you don't understand? Please do some legwork first before asking questions here.
 
Naziru Gelajo
Ranch Hand
Posts: 175
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you mean Method parameters and not class parameters unless you are talking about Constructors which do indeed can have parameters which you can call in a subclass via the super() keyword. Though, I don't think that is what you are referring to.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!