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 262 views
262 views asked May 27, 2023 by avibootz
4 answers 384 views
4 answers 730 views
2 answers 370 views
2 answers 376 views
1 answer 352 views
...