CSE 8B Chapter Notes - Chapter 9.6 - 9.11: Static Variable

36 views3 pages

Document Summary

9. 6 using classes from the java library. Java api contains classes that are useful in developing java programs. Date class can be used to obtain time. gettime(: returns elapsed time since january 1, 1970, gmt. tostring(: returns string version of the elapsed time since january 1, 1970, gmt. When creating a random object, you must specify seed: seed is a number used to initialize random number generator, default seed is current elapsed time. If 2 random objects have the same seed, then they will generate identical sets of numbers. Point2d class represents a point in a 2d plane. Can create a point2d object with specified x-, y-coordinates. distance(: computes distance from this point to another point. Static variable is a variable shared by all objects of the class. If one o(cid:271)je(cid:272)t (cid:272)hanges the (cid:448)alue of this stati(cid:272) (cid:448)aria(cid:271)le, then all o(cid:271)je(cid:272)t"s (cid:449)ill have this new altered value. Static method cannot access instance members of the class.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents