This site requires JavaScript, please enable it in your browser!
Greenfoot back
reillykid12
reillykid12 wrote ...

2014/6/14

what do these terms mean?

reillykid12 reillykid12

2014/6/14

#
private static final double GRAVITY=5.8; What do private static final and double indicate in the above statement
danpost danpost

2014/6/14

#
'private' sets the accessibility of the field to only the class the line is in (see Controlling Access to Members of a Class). 'static' means that the field belongs to the class and not to any particular object of that class. 'final' means that the field value will not change (it is a constant) (for the last 2, see Understanding Class Members). 'double' means that the field will hold value of the primitive type 'double' (see Primitive Data Types ). GRAVITY is the name assigned to the field (the names of constants are, by convention, given in all caps). '= 5.8' give the field an assigned value of '5.8'.
You need to login to post a reply.