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.
It doesn't change anything, this approach would work fine.
But there's a caveat: if the first string is really long it'll be slow.
What happens if str2 is longer than str1
This comment is hidden because it contains spoiler information about the solution
Why is there 7?
Well, i guess you can still one-line in java
You might want to avoid comparing Strings with ==, as it can fail under some situations.
Try using string1.equals(string2) instead which is very reliable.
Double declaration performs slower than boolean test and should be avoided