Get a single char by index

ReturnMethodSummary
charcharAt(int index)Returns the char value at the specified index.

public class Main {
  public static void main(String[] argv) {
    byte[] bytes = new byte[]{67,68,69}; 
    
    String str = new String(bytes);
    
    System.out.println(str.charAt(0));
  }
}

The output:


C
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.