String charAt()

Let us understand charAt() method This method returns the character at the specified index and Index starts from 0 Method signature public char charAt(int index) public char charAt(int index) This method throws StringIndexOutOfBoundsException exception When, index is either negative or greater than or equal to the size of the string Example public class CharAtExample1{   […]

Share this article on

Introduction to Strings

Strings are most widely used in Java programming. Strings basically represent a sequence of characters. In the Java programming language, strings are objects. The Java platform provides the String class to create and manipulate strings. Example: Char[] c = {‘H’,’e’,’l’,’l’,’o’}; Char[] c = {‘H’,’e’,’l’,’l’,’o’}; ‘c’ is the character array having sequence of characters and same […]

Share this article on
< Previous Next >