How to get the second character from a string in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String s = "programming java";
 
        char ch = s.charAt(1);
        
        System.out.println(ch);
    }
}
 
 
 
/*
run:
 
r
 
*/

 



answered Oct 30, 2020 by avibootz

Related questions

1 answer 239 views
1 answer 260 views
1 answer 177 views
1 answer 229 views
2 answers 318 views
...