+ 2
Reserved Keyword In Java Language!
Below are all the Java language keywords: abstract assert (since Java 1.4) boolean break byte case catch char class const (not used) continue default do double else enum (since Java 5.0) extends final finally float for goto (not used) if implements import instanceof int interface long native new package private protected public return short static strictfp (since Java 1.2) super switch synchronized this throw throws transient try void volatile while
3 Antworten
+ 2
Assertion
An assertion checks if a condition is true:
Code section 3.6: A return statement.
public int getAge() {
assert age >= 0;
return age;
}
Each assert statement is ended by a semi-colon (;). However, assertions are disabled by default, so you must run the program with the -ea argument in order for assertions to be
enabled (java -ea [name of compiled program]).
+ 2
strictfp is a java keyword, since Java 1.2 .
It makes sure that floating point calculations result precisely the same regardless of the underlying operating system and hardware platform, even if more precision could be
obtained. This is compatible with the earlier version of Java 1.1 . If you need that use it.
Syntax for classes:
public strictfp class MyClass
{
//...
}
Syntax for methods:
public strictfp void method()
+ 1
what are strictfp and assert used for?