Browsing 7239 questions and answers with Jon Skeet
It's not in javadoc because it's not a method you call - it's part of the syntax of the language. It's a class literal, which is described in the Java Language Specification section 15.8.2: A class literal is an expression consisting... more 4/19/2014 4:03:00 PM
Yes, if you have a method with a varargs parameter like this: public void foo(String... names) and you call it like this: foo("x", "y", "z"); then the compiler just converts that into: foo(new String[] { "x", "y", "z"}); The type... more 4/19/2014 9:37:48 AM
If you want to be able to save the scores again, using getResourceAsStream isn't really a good idea - that's meant for resources which are bundled with the application, often within a jar file, and often read-only. You might want to... more 4/18/2014 5:12:55 PM
You've got three problems here: You're calling toString() on byte[], which is just going to give you something like "[B@15db9742" You're assuming you can just convert a byte array into text with no specific conversion, and not lose... more 4/17/2014 8:22:39 PM
the second command seems to do nothing. What is the reason? The second method is asynchronous, which means exceptions are never thrown directly to the caller - whether the exception occurs while the method is executing synchronously... more 4/15/2014 9:31:23 PM
Yes, using the same text file format. Just use TextFormat.merge, passing in either the text itself as a CharSequence or a Readable (e.g. Reader) and a builder to merge the values into. See the Javadoc for TextFormat for more information,... more 4/15/2014 9:26:44 PM
Fundamentally, this depends on the character encoding. If you're using UTF-8 and have non-ASCII characters in your text, then a character offset tells you relatively little about the byte offset you'd have to seek to. (File systems are... more 4/15/2014 9:22:02 PM
No, it's not BCD (where each digit is individually encoded in a specific number of bits) - but you don't want it to be. (And I certainly never claimed it was.) decimal is a floating point type in that it has a significand and an exponent,... more 4/15/2014 5:35:04 PM
If you choose to ignore parameter/return type covariance/contravariance (both the variance supported by the compiler since C# 2.0 and the generic covariant/contravariance with in / out), demanding just equality of types, you could... more 4/15/2014 5:48:09 AM
Well it would be better to avoid checking the name: if (this.getClass() == A.class) Beyond that, you could consider using a protected constructor - but that would still be accessible within the same package. Normally, the best solution... more 4/14/2014 9:46:51 PM