MongDB version 3.6
JavaSE passing data among methods
JavaSE float double
In Java, default floating type is double.
For example, 3.25 is double rather than float unless f is added to the end of 3.25, i.e. 3.25f.
JavaSE encapsulation & immutability
JavaSE constructor
JavaSE static
Where to use key word static?
- method
- field
1 | public class Koala{ |
JavaSE method
Write Methods
- What is a method like?
Element | Value in nap() example | Required? |
---|---|---|
Access modifier | public | no |
Optional specifier | final | no |
Return type | void | yes |
Method name | nap | yes |
Parameter list | (int minutes) | yes(can be empty) |
Optional exception list | throws InterruptedException | no |
Method body | { // take a nap } | yes(can be empty braces) |
JavaSE import
1 | package aquarium; |