final Random coin = new Random(); final int flip_result = coin.nextInt(2);
The class uses special pattern characters to refer to the components of a date or time text.
Symbol | Meaning | Presentation Kind | Example |
---|---|---|---|
G | era designator | Text | AD |
y | year | Year | yyy:96 yyyy:1996 |
M | month in year | Month | M:7 MM:07 MMM:Jul MMMM:July |
w | week in year | Number | 27 |
W | week in month | Number | 2 |
D | day in year | Number | 189 |
d | day in month | Number | 10 |
F | day of week in month; as in: 2nd Tue in Jul | Number | 2 |
E | day in week | Abbreviated Text | EEE:Tue EEEE:Tuesday |
a | am/pm marker | Text | PM |
H | hour in day (0-23) | Number | 13 |
k | hour in day (1-24) | Number | 24 |
K | hour in am/pm (0-11) | Number | 0 |
h | hour in am/pm (1-12) | Number | 11 |
m | minute in hour | Number | m:3 mm:03 mmm:003 |
s | second in minute | Number | 55 |
S | millisecond | Number | 978 |
z | time zone | Abbreviated Text | zzz:EST zzzz:Eastern Standard Time |
Z | time zone (RFC 822) | Text | -0800 |
Property Name | description |
---|---|
file.encoding | The character encoding for the default locale |
file.encoding.pkg | The package that contains the converters that handle converting between local encodings and Unicode |
java.awt.fonts | |
java.awt.graphicsenv | |
java.awt.printerjob | |
java.class.path | The value of the CLASSPATH environment variable |
java.class.version | The version of the Java API |
java.compiler | The just-in-time compiler to use, if any. Initialized from the environment variable JAVA_COMPILER. |
java.ext.dirs | The directory in which Java extentions are installed |
java.home | The directory in which Java is installed |
java.io.tmpdir | The directory in which Java should create temporary files |
java.security.policy | |
java.version | The version of the Java interpreter |
java.vendor | A vendor-specific string |
java.vendor.url | A vendor URL |
java.vm.info | |
java.vm.name | |
java.vm.specification.name | |
java.vm.specification.vendor | |
java.vm.specification.version | |
java.vm.vendor | |
java.vm.version | |
file.separator | The platform-dependent file separator (e.g., "/" on UNIX, "\" for Windows) |
path.separator | The platform-dependent path separator (e.g., ":" on UNIX, "," for Windows) |
line.separator | The platform-dependent line separator (e.g., "\n" on UNIX, "\r\n" for Windows) |
os.arch | The system architecture |
os.name | The name of the operating system |
os.version | The operating system version |
user.dir | The current working directory when the properties were initialized |
user.home | The home directory of the current user |
user.language | The two-letter language code of the default locale Solaris: initialized from env var LANG |
user.name | The username of the current user |
user.region | The two-letter country code of the default locale |
user.timezone | The default time zone |
font.properties | Java 1.2 AWT |
swing.defaultlaf | Control look-and-feel |
awt.image.incrementaldraw | if true (default) draw parts of images as it arrives. |
awt.image.redrawrate | Minimum period in milliseconds between calls to repraint (default is 100) |
property | Unix | Windows | MacIntosh |
---|---|---|---|
file.separator | / | \ | : |
line.separator | \n | \r\n | \r |
path.separator | : | ; | : |
Examples using the Java class.
A stream tokenizer is initialized to the following default state:
'A'
through 'Z'
,
'a'
through 'z'
, and
'\u00A0'
through '\u00FF'
are
considered to be alphabetic.
'\u0000'
through
'\u0020'
are considered to be white space.
'/'
is a comment character.
'\''
and double quote '"'
are string quote characters.
Unless the syntax table is reset, the StreamTokenizer methods add new ranges of characters to the individual categories and does not replace the initial ranges.
Using method
enum color { red, orange, yellow, green, blue };