Write a program in java to demonstrate toCharArray() method?

class StringToChar

{

                public static void main(String arg[])

                {

                                String s="India";

                                char a[]=s.toCharArray();

                                for(int i=0;i<s.length();i++)

                                                System.out.println(a[i]);

                }

}

toCharArray() method.PNG

, , , , ,

Leave a Reply