W3Schools
w3schools.com › JAVA › ref_string_charat.asp
Java String charAt() Method
Java Examples Java Videos Java ... Java Study Plan Java Interview Q&A ... The charAt() method returns the character at the specified index in a string....
GeeksforGeeks
geeksforgeeks.org › java › java-string-charat-method-example
Java String charAt() Method - GeeksforGeeks
June 1, 2026 - class Geeks { public static void main(String args[]) { // Define a string String s = "Java String charAt() example"; // Retrieve and print the character at index 8 char ch = s.charAt(8); System.out.println(ch); // Retrieve and print the character at index 24 ch = s.charAt(24); System.out.println(ch); } }
How is String charAt implemented in Java?
if you go to line 111 you'll see that the inside of a String is a char[] already More on reddit.com
Char and scanner error
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
Char .equals() method
char and all primitive types (int, boolean, etc.) are not objects, and thus do not have methods attached to them. If you want to compare the values of primitive types, just use double equals (==). The exception to this is a concept called "autoboxing" and "unboxing", which include the object forms of primitives (Character, Integer, Boolean, etc.), in which you can call methods such as equals(), toString(), and so forth. Unless you really have to, like with specifying generic types or supporting null, you'll use a primitive type instead of its boxed form. Here's some more reading if you like. More on reddit.com
How do you count the number characters in a portion of a string?
You have the overall length of the string. You have the position of the decimal point. This is all you need. A little bit of mathematics will do the rest. Think about it: 123.4567 The overall length is 8 characters. The position of the decimal point is 3 (positions are 0-based) - it is the 4th character in the string. How many characters are before the decimal point? How many characters are after? (the length and the position of the decimal point are all you need to calculate the characters) Edit: if you are not allowed to use .indexOf, you could loop over the whole string, character by character (.charAt) and compare and count. If you reach the decimal point, you have the number of digits before the decimal point, and then either keep looping and count again (with the counter reset before restarting the count) to get the number of digits after, or, you calculate (again with the length). More on reddit.com
00:57
Java Strings 101: charAt() Method Explained with Easy Examples ...
02:40
Java Programming - String Functions - charAt() - YouTube
02:06
Java String Methods Explained: length(), charAt(), substring() ...
How to print all the characters of a String using the charAt ...
java string charat example | java program to print even ...
01:46
Java String Tutorial: Getting Characters with the charAt() Method ...
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › String.html
String (Java Platform SE 8 )
July 21, 2026 - Java™ Platform Standard Ed. 8 ... The String class represents character strings.
Scaler
scaler.com › home › topics › java string charat() method
Java String charAt() Method - Scaler Topics
April 21, 2024 - The method charAt() in Java can be defined as the inbuilt method that returns the character value at the stated index number when searched in a string. Learn more on Scaler Topics.
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › charAt
String.prototype.charAt() - JavaScript | MDN
The charAt() method of String values returns a new string consisting of the single UTF-16 code unit at the given index.
Codecademy
codecademy.com › docs › java › strings › .charat()
Java | Strings | .charAt() | Codecademy
May 29, 2025 - In Java, the .charAt() method returns the character at a specified index in a string.
Tutorialspoint
tutorialspoint.com › java › lang › string_charat.htm
Java - String charAt() Method
The Java String charAt() method is used to retrieve the character at the specified index. The indexes refer to the character position in the sequence. The first char value represents the 0th index, and the next char value represents the 1st ...
Reddit
reddit.com › r/learnprogramming › how is string charat implemented in java?
r/learnprogramming on Reddit: How is String charAt implemented in Java?
August 30, 2021 -
If I'm not mistaken, StringBuilder objects are stored as a char array. So when we use the String charAt method, does Java convert the string into a char array as well?
Top answer 1 of 4
7
if you go to line 111 you'll see that the inside of a String is a char[] already
2 of 4
1
Interesting. UTF is a character encoding that extended on ASCII (which had maybe 128 valid characters). UTF is actually a family of "codepoints". The binary representation of certain characters, say, 'b' might differ from UTF-16 (where 2 bytes are used per character) or UTF-8 where the number of bytes varies depending on the character (all the 1 byte characters are compatible with ASCII). You can have a file encoded in UTF-8, but it looks like Java converts these UTF-8 codepoints to UTF-16 format when it stores it as a String to make operations like charAt more convenient to implement.
W3Schools
w3schools.com › java › java_ref_string.asp
Java String Reference
assert abstract boolean break byte case catch char class continue default do double else enum exports extends final finally float for if implements import instanceof int interface long module native new package private protected public return requires short static super switch synchronized this throw throws transient try var void volatile while Java String Methods · charAt() codePointAt() codePointBefore() codePointCount() compareTo() compareToIgnoreCase() concat() contains() contentEquals() copyValueOf() endsWith() equals() equalsIgnoreCase() format() getBytes() getChars() hashCode() indexOf() isEmpty() join() lastIndexOf() length() matches() offsetByCodePoints() regionMatches() replace() replaceAll() replaceFirst() split() startsWith() subSequence() substring() toCharArray() toLowerCase() toString() toUpperCase() trim() valueOf() Java Math Methods ·
W3Resource
w3resource.com › java-tutorial › string › string_charat.php
Java String charAt() Method - w3resource
Java String charAt() Method: Returns the character value at the specified index.
Dinesh on Java
dineshonjava.com › home › java – string charat() method
Java - String charAt() Method - Dinesh on Java
September 16, 2017 - Description: This method returns the character located at the String’s specified index. The string indexes start from zero. Syntax: Here is the syntax of this method: public char charAt(int index) Parameters: Here is the detail of parameters: index — Index of the character to be returned.
GeeksforGeeks
geeksforgeeks.org › java › strings-in-java
Java Strings - GeeksforGeeks
Using the new keyword creates a new object in heap memory, even if the same string already exists in the pool. ... The CharSequence interface represents a sequence of characters in Java. It provides common methods such as length(), charAt(), subSequence(), and toString() for working with character sequences.
Published: 2 weeks ago
w3resource
w3resource.com.cach3.com › java-tutorial › string › string_charat.php.html
Java String: charAt Method - w3resource
May 28, 2022 - Java String charAt Method: Returns the char value at the specified index.