String to char in java

Java convert string to char using charAt() method

package com.w3schools;

public class StringToChar {
  public static void main(String args[]){
      String str = "w3spoint";
      for(int i=0; i

Output:

Character at 0 Position: w
Character at 1 Position: 3
Character at 2 Position: s
Character at 3 Position: p
Character at 4 Position: o
Character at 5 Position: i
Character at 6 Position: n
Character at 7 Position: t

Download this example.

Please follow and like us:
Content Protection by DMCA.com