publicclass Constants { /* *Thiscompile-onlytestistomakesurethattheprimitive *publicstaticfinalfieldsinjava.lang.Doubleare"constant *expressions"asdefinedby"TheJavaLanguageSpecification, *2ndedition"section15.28;adifferenttestchecksthevalues *ofthosefields.
*/ publicstaticvoid main(String[] args) throws Exception { int i = 0; switch (i) { case (int)Double.NaN: // 0
System.out.println("Double.NaN is a constant!"); break; case (int)Double.MIN_VALUE + 1: // 0 + 1
System.out.println("Double.MIN_VALUE is a constant!"); break; case (int)Double.MIN_NORMAL + 2: // 0 + 2
System.out.println("Double.MIN_NORMAL is a constant!"); break; caseDouble.MIN_EXPONENT: // -1022
System.out.println("Double.MIN_EXPONENT is a constant!"); break; caseDouble.MAX_EXPONENT: // 1023
System.out.println("Double.MAX_EXPONENT is a constant!"); break; case (int)Double.MAX_VALUE - 1: // Integer.MAX_VALUE - 1
System.out.println("Double.MAX_VALUE is a constant!"); break; case (int)Double.POSITIVE_INFINITY: // Integer.MAX_VALUE
System.out.println("Double.POSITIVE_INFINITY is a constant!"); break; case (int)Double.NEGATIVE_INFINITY: // Integer.MIN_VALUE
System.out.println("Double.NEGATIVE_INFINITY is a constant!"); break;
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.