diff options
author | Cássio Böck <cassio.bock@gmail.com> | 2015-10-25 15:48:46 -0200 |
---|---|---|
committer | Cássio Böck <cassio.bock@gmail.com> | 2015-10-25 15:48:46 -0200 |
commit | 784327031304c54a8b7febc424b0e8832e55f4bf (patch) | |
tree | 30f6d413e175bf739d25995e187afc9165f39dd8 /java.html.markdown | |
parent | d9d8de0d229443534272e2a1976fb7f0e69631b6 (diff) | |
parent | ac4bb69e02bf25ff687962e6105452589eb4fa78 (diff) |
Merge remote-tracking branch 'refs/remotes/adambard/master'
Diffstat (limited to 'java.html.markdown')
-rw-r--r-- | java.html.markdown | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/java.html.markdown b/java.html.markdown index 38c9e490..aae64ccf 100644 --- a/java.html.markdown +++ b/java.html.markdown @@ -450,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() { |