- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to get a character located at the String's specified index
Use the charAt() method in Java to get a character located at a specified index.
Let’s say the following is our string.
String str = "Laptop...";
Finding character at 3rd position.
str.charAt(2);
The following is the final example.
Example
public class Demo { public static void main(String[] args) { String str = "Laptop..."; System.out.println("String: "+str); System.out.println("Character at position 3 = " +str.charAt(2)); } }
Output
String: Laptop... Character at position 3 = p
- Related Articles
- Java Program to remove a character at a specified position
- Java Program to Replace a Character at a Specific Index
- Java Program to determine a Character's Unicode Block
- Java Program to Get a Character From the Given String
- Can I get the node at a specified index in a JTree with Java?
- C++ Program to Replace a Character at a Specific Index
- How to get a part of string after a specified character in JavaScript?
- Left pad a String with a specified character in Java
- Java Program to search for a Substring from a specified index
- Python program to return rows that have element at a specified index
- Get or Set at specified index in StringCollection in C#
- Python program to change character of a string using given index
- What's the Kotlin equivalent of Java's String[]?
- Replace an element at a specified index of the Vector in Java
- C++ program to find string after adding character 'a' string becomes non-palindrome

Advertisements