Ad
  • Default User Avatar

    After setting i to 1 circle of loop finished and next line of code that will be executed is i++. So, yes, in begining of next circle of loop i will be equal to 2

  • Default User Avatar

    What exactly does setting i to 1 in the for loop do? I can see that it matters, because you lose multiples of 2 if you take it out, but I don't understand what it does. When the conditions of the for loop are evaluated once i is set to 1, does i get reset to 2?

  • Default User Avatar
  • Custom User Avatar
  • Default User Avatar

    Is recursion faster/uses less memory than a for loop?

  • Default User Avatar

    When I put this into eclipse like it is, then try some examples in the main method, I get the following error messages:
    For example:
    public static void main(String[] args) {
    System.out.println(camelCase("thisIsOneString"));
    }

    Exception in thread "main" java.lang.IndexOutOfBoundsException: No group 1
    at java.base/java.util.regex.Matcher.start(Matcher.java:482)
    at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1090)
    at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:997)
    at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1181)
    at java.base/java.lang.String.replaceAll(String.java:2142)
    at DigPow/myPackage.Solution2.camelCase(Solution2.java:6)
    at DigPow/myPackage.Solution2.main(Solution2.java:9)

    What does it mean by group 1?