Wednesday, 9 March 2016

Java Tutorial : Java String (Getting characters using charAt method)


Click here to watch in Youtube :
https://www.youtube.com/watch?v=a8MEH8joA4w&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge

CharAtDemo.java
/*
 * public char charAt(int index)
 * 
 * Parameters:
 * ----------                           
 * index - the index of the char value.
 * 
 * Returns:
 * -------- 
 * The char value at the specified index of
 * this string. The first char value is at index 0.
 */

public class CharAtDemo
{

    public static void main(String[] args)
    {
        String str = "Welcome";

        char ch = str.charAt(3);
        System.out.println("charAt(3) = " + ch);

        ch = str.charAt(5);
        System.out.println("charAt(5) = " + ch);
    }
}
Output
charAt(3) = c
charAt(5) = m
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_charAt_Get_char_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_charAt_Get_char_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/764ecf5c6cba932aee2ceef22ba699fc15012e37/BasicJava/StringDemo_charAt_Get_char_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge