| Author |
help please quick question
|
Jacob Rich
Greenhorn
Joined: Jan 02, 2007
Posts: 27
|
|
in the above line of code Math.random() is a method right? I'm trying to learn and i'm just not sure about which are variables, objects, and methods in code, havent had much experience yet. Thanks.
|
~"Great is the art of beginning, but greater is the art of ending."~
|
 |
Kelvin Chenhao Lim
Ranch Hand
Joined: Oct 20, 2007
Posts: 513
|
|
|
"Math.random()" is a call to the static method "random" of the "Math" class. Static methods can be invoked directly with the class name, without first instantiating an object instance of the class. Normal (non-static) methods can only be invoked on object instances.
|
SCJP 5.0
|
 |
Jacob Rich
Greenhorn
Joined: Jan 02, 2007
Posts: 27
|
|
|
ah I see, I get what you mean I think... just dont understand what an object class quite is.
|
 |
Adam Schaible
Ranch Hand
Joined: Oct 04, 2007
Posts: 101
|
|
Hello Jacob, Whenever you create a new file and type you're creating a class. In your code, when you do something like: you're creating an object. The common example is that a class is an object's blueprint. In the class, you define what attributes the object may have, what behavior it may have, etc. A class and an object are different states of the same thing - not unlike water and ice. Does that help?
|
 |
Jacob Rich
Greenhorn
Joined: Jan 02, 2007
Posts: 27
|
|
very much so, thanks
|
 |
 |
|
|
subject: help please quick question
|
|
|