diff options
author | Martin Schimandl <martin.schimandl@gmail.com> | 2015-10-24 07:28:36 +0200 |
---|---|---|
committer | Martin Schimandl <martin.schimandl@gmail.com> | 2015-10-24 07:28:36 +0200 |
commit | 28f71ffcccc6d69d4eb6fc2de0f384fe708362f5 (patch) | |
tree | 824a79dba743213cef1297a870c97c88e61b6c63 /java.html.markdown | |
parent | 543f10b5626a600b27f5fb70212720a17a4f190e (diff) | |
parent | ab67a8f4c29309d7fd5e0b1bd3255fe695beb8cf (diff) |
Merge remote-tracking branch 'adambard/master'
Diffstat (limited to 'java.html.markdown')
-rw-r--r-- | java.html.markdown | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/java.html.markdown b/java.html.markdown index c2c1a18b..aae64ccf 100644 --- a/java.html.markdown +++ b/java.html.markdown @@ -7,6 +7,7 @@ contributors: - ["Simon Morgan", "http://sjm.io/"] - ["Zachary Ferguson", "http://github.com/zfergus2"] - ["Cameron Schermerhorn", "http://github.com/cschermerhorn"] + - ["Rachel Stiyer", "https://github.com/rstiyer"] filename: LearnJava.java --- @@ -137,7 +138,7 @@ public class LearnJava { // // BigDecimal allows the programmer complete control over decimal // rounding. It is recommended to use BigDecimal with currency values - // and where exact decimal percision is required. + // and where exact decimal precision is required. // // BigDecimal can be initialized with an int, long, double or String // or by initializing the unscaled value (BigInteger) and scale (int). @@ -184,8 +185,12 @@ public class LearnJava { // LinkedLists - Implementation of doubly-linked list. All of the // operations perform as could be expected for a // doubly-linked list. - // Maps - A set of objects that maps keys to values. A map cannot - // contain duplicate keys; each key can map to at most one value. + // Maps - A set of objects that map keys to values. Map is + // an interface and therefore cannot be instantiated. + // The type of keys and values contained in a Map must + // be specified upon instantiation of the implementing + // class. Each key may map to only one corresponding value, + // and each key may appear only once (no duplicates). // HashMaps - This class uses a hashtable to implement the Map // interface. This allows the execution time of basic // operations, such as get and insert element, to remain @@ -445,6 +450,17 @@ class Bicycle { protected int gear; // Protected: Accessible from the class and subclasses String name; // default: Only accessible from within this package + static String className; // Static class variable + + // Static block + // Java has no implementation of static constructors, but + // has a static block that can be used to initialize class variables + // (static variables). + // This block will be called when the class is loaded. + static { + className = "Bicycle"; + } + // Constructors are a way of creating classes // This is a constructor public Bicycle() { |