How to capitalize first letter of String Java

By | August 9, 2020

How to capitalize first letter of String Java:

In this article, you will learn how to capitalize first letter of string java. 

Here we have 2 approaches.

1. Use capitalize method of StringUtils

2. Using substring method


1. StringUtils.capitalize() method:

This method is coming from apache. It capitalizes the first letter of a string. It will not capitalize any other letter.



2. Using String substring() method:

Above method extracts first letter of the string and capitalizes it. Then we join the 2nd substring to the 1st substring to get the desired output.


Recommended Posts:

Covert String to int in Java

Star pattern programs in Java

Get last 4 chars from String

Timeout test in TestNG

How to clear an arraylist in java

Java interview questions

Real-time selenium interview questions

SQL quick reference for interview preparation



Tags: how to capitalize first letter of string java


Note: If you like and want to contribute articles, then please send your articles at


Links: TestNG

arrays tostring in java | selenium interview questions | binary search






Play & Win contest by Selenium99

Home 1



Leave a Reply

Your email address will not be published. Required fields are marked *