mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-12 09:44:24 +02:00
[java/en] Enum Type
This commit is contained in:
@@ -450,6 +450,17 @@ class Bicycle {
|
|||||||
protected int gear; // Protected: Accessible from the class and subclasses
|
protected int gear; // Protected: Accessible from the class and subclasses
|
||||||
String name; // default: Only accessible from within this package
|
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
|
// Constructors are a way of creating classes
|
||||||
// This is a constructor
|
// This is a constructor
|
||||||
public Bicycle() {
|
public Bicycle() {
|
||||||
@@ -767,7 +778,7 @@ The links provided here below are just to get an understanding of the topic, fee
|
|||||||
|
|
||||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||||
|
|
||||||
* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconv-138413.html)
|
* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
|
||||||
|
|
||||||
**Online Practice and Tutorials**
|
**Online Practice and Tutorials**
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user