How to print the characters from a StringBuilder() in Java

1 Answer

0 votes
package javaapplication1;

import java.io.IOException;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {

        StringBuilder sb = new StringBuilder("java c c++ c#");

        for (int i = 0; i < sb.length(); i++) {
            System.out.println(sb.charAt(i));
        }
    }
}


/*

run:
                   
j
a
v
a
 
c
 
c
+
+
 
c
#
          
 */

 



answered Dec 19, 2016 by avibootz
edited Jan 10, 2017 by avibootz

Related questions

1 answer 143 views
1 answer 111 views
1 answer 233 views
1 answer 141 views
1 answer 177 views
1 answer 151 views
...