How to print the characters in string with Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String s = "java";
        
        for (int i = 0; i < s.length(); i++) {
            System.out.println(s.charAt(i));
        }
    }
}



/*
run:

j
a
v
a

*/

 



answered Nov 1, 2020 by avibootz
...