- 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 Program to check if a string is empty or not
The following is our string −
String str = "";
We will check whether it is empty or not using the isEmpty() method. The result will be a boolean −
str.isEmpty()
The following is an example −
Example
public class Demo { public static void main(String[] args) { String str = ""; System.out.println("String is empty: "+str.isEmpty()); } }
Output
String is empty: true
- Related Articles
- Java Program to Check if a String is Empty or Null
- Python program to check if the string is empty or not
- Golang program to check if a string is empty or null
- Check if a String is not empty ("") and not null in Java
- Check if a String is empty ("") or null in Java
- Golang Program to check the given string is empty or not
- Check if a String is whitespace, empty ("") or null in Java
- How to Check if an Array is Empty or Not in Java
- Python program to check if a string is palindrome or not
- C# program to check if a string is palindrome or not
- C# program to check if string is panagram or not
- Swift program to check if string is pangram or not
- Check if a directory is not empty in Java
- C# program to check whether a list is empty or not
- Python program to check whether a list is empty or not?

Advertisements