troubleshooting Question

oneTwo java challenge

Avatar of gudii9
gudii9Flag for United States of America asked on
JavaJava EEProgramming Languages-OtherJava App ServersProgramming
31 Comments3 Solutions2195 ViewsLast Modified:
Hi,
I am working on below challenge
http://codingbat.com/prob/p122943
I tried my code as below
public String oneTwo(String str) {
StringBuilder sb=new StringBuilder();
int strLen=str.length();
for(int i=0;i<=strLen-3;i+2){
sb.append(str.substring(i,i+3));
}
return sb.toString();
  
}
I am getting below result
Compile problems:


Error:      for(int i=0;i<=strLen-3;i+2){
                               ^
Syntax error on token "+", invalid AssignmentOperator


see Example Code to help with compile problems

cannot i give increment as i+2 instead of i++ in for loop?

how to  improve my approach, results and design of this challenge. How do i make a graphical venn or flow chart or some other relevant diagram to design it before writing code to decide best strategy?
 Please advise
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 31 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 31 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros