How to convert String to char in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String str = "c";
        
        char ch = str.charAt(0);
        
        System.out.println(ch);
    }
}




/*
run:

c

*/

 



answered Nov 22, 2023 by avibootz

Related questions

2 answers 156 views
156 views asked May 27, 2023 by avibootz
4 answers 223 views
4 answers 545 views
2 answers 248 views
2 answers 263 views
1 answer 251 views
...