publicclass LoadParsing { publicstaticvoid main(String[] argv) throws Exception {
File f = new File(System.getProperty("test.src", "."), "input.txt");
FileInputStream myIn = new FileInputStream(f);
Properties myProps = new Properties(); int size = 0; try {
myProps.load(myIn);
} finally {
myIn.close();
}
if (!myProps.getProperty("key1").equals("value1")) thrownew RuntimeException("Bad comment parsing"); if (!myProps.getProperty("key2").equals("abc\\defg\\")) thrownew RuntimeException("Bad slash parsing"); if (!myProps.getProperty("key3").equals("value3")) thrownew RuntimeException("Adds spaces to key"); if (!myProps.getProperty("key4").equals(":value4")) thrownew RuntimeException("Bad separator parsing"); if (myProps.getProperty("#") != null) thrownew RuntimeException( "Does not recognize comments with leading spaces"); if ((size=myProps.size()) != 4) thrownew RuntimeException( "Wrong number of keys in Properties; expected 4, got " +
size + ".");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-10-11)
¤
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.