Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
just for arguments sake, i wouldnt make human an interface since men and women share attributes, not just behaviors
I love it! Beautiful, even if it's in the same complexity class ;)
This comment is hidden because it contains spoiler information about the solution
This is common in a lot of languages.
@nuzyly Yes, you are completely correct.
ArithmeticException
is a subclass ofRuntimeException
.RuntimeException
andError
are called unchecked in Java terminology, because they do not need to be declared in athrows
clause of a method. That's because they are meant to represent programming problems, that client code cannot expect to recover from (see the documentation and this short article for the details).So my question is: Why should one declare such an exception? You wouldn't generally declare
NullPointerException
s, would you? I think it would be more appropriate, to document this kind of exception in a doc comment:/** @throws ArithmeticException if the result overflows a long */
The intention is better readable that way, but a comment would suit it better, I'd say.
What do you mean?
Why declare an unchecked exception?
Very nice, but let me ask:
PS: If the code would be used on a lot of URLs, it would save some load to call replace("-", " ") with the return statement, like so: return item.replace("-", " ");
and split the stream with "-".
The (Java) Kata provides an array of Objects, but does only provide Strings in it. This leads to a lot of solutions, that skip type checking and casting (if necessary) and thus reinforces bad coding habits.
So is it clever or best practice? :)
JavaScript engines, when parsing the code will do semi-colon insertion. So while semicolons can be omitted in most cases, the JS engine is still adding them back in before the code is executed. This can really jack up your program if you are not aware of the insertion rules. http://inimino.org/~inimino/blog/javascript_semicolons.
JS does not enforce semicolons except in very specific cases.
This comment is hidden because it contains spoiler information about the solution
Loading more items...