- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 String isEmpty() method example.
The isEmpty() method of the String class returns true if the length of the current string is 0.
Example
import java.lang.*; public class StringDemo { public static void main(String[] args) { String str = "tutorialspoint"; //prints length of string System.out.println("length of string = " + str.length()); //checks if the string is empty or not System.out.println("is this string empty? = " + str.isEmpty()); } }
Output
length of string = 14 is this string empty? = false
- Related Articles
- NavigableMap isEmpty() Method in Java
- The isEmpty() method of CopyOnWriteArrayList method in Java
- Java String compareTo() Method example.
- Java String substring() Method example.
- Java String endsWith() method example.
- Java String equals() method example.
- Java String equalsIgnoreCase() method example.
- Java String format() method example.
- Java String getBytes() method example.
- Java String getChars() method example.
- Java String indexOf() method example.
- Java String intern() method example.
- Java String lastIndexOf() method example.
- Java String length() method example.
- Java String replace() method example.

Advertisements