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 264 views
264 views asked May 27, 2023 by avibootz
4 answers 393 views
4 answers 733 views
2 answers 371 views
2 answers 381 views
1 answer 355 views
...