-
/*Java String isEmpty Example.This Java String isEmpty example shows how to check whether the givenstring is empty or not using isEmpty method of Java String class.*/public class JavaStringIsEmptyExample {public static void main(String args[]){
String str1 = “”;String str2 = null;String str3 = “Hello World”;
/** To check whether the String is empty or not, use* boolean isEmpty() method of Java String class.** This method returns true if and only if string.length() is 0.*/
System.out.println(“Is String 1 empty? :” + str1.isEmpty());
//this will throw NullPointerException since str2 is null//System.out.println(“Is String 2 empty? :” + str2.isEmpty());System.out.println(“Is String 3 empty? :” + str3.isEmpty());
/** Please note that isEmpty method was added in JDK 1.6 and it is not available* in previous versions.** However, you can use* (string.length() == 0) instead of (string.isEmpty())* in previous JDK versions.*/}}
/*Output of Java String isEmpty would beIs String 1 empty? :trueIs String 3 empty? :false*/
Friday, 13 April 2018
Popular Posts
-
Deep learning is at the heart of modern Artificial Intelligence — powering technologies like chatbots, recommendation systems, image recog...
-
Explanation: ๐น Step 1: Create List x = [1,2,3] A list x is created ๐ Values inside list: 1, 2, 3 ๐น Step 2: Understand sum() Function su...
-
What you'll learn Understand why version control is a fundamental tool for coding and collaboration Install and run Git on your local ...
-
Introduction Deep learning is one of the most powerful branches of AI, enabling systems to learn complex patterns from data by mimicking ...
-
Explanation: ๐น 1. Creating the List x = [[1]*2]*2 ๐ Break it step by step: [1]*2 → creates [1, 1] [[1]*2]*2 → creates two references to ...
-
When people think about data science, they often focus on tools like Python, machine learning models, or deep learning frameworks. But beh...
-
๐ Day 27/150 – Print Even Numbers up to N in Python Printing even numbers up to N is a great way to understand loops, conditions, and n...
-
Explanation: ๐น 1. Function Definition def func(): This line defines a function named func. It does not take any arguments. Because it use...
-
Explanation: ๐ง 1. Operator Precedence (Priority Rules) In Python, logical operators follow this order: and → evaluated first or → evaluat...
-
Code Expanation: ๐น Step 1: Create List x = [0, 1, 2] A list x is created ๐ Elements: 0, 1, 2 ๐น Step 2: Understand all() Function all(x)...
Categories
100 Python Programs for Beginner
(119)
AI
(254)
Android
(25)
AngularJS
(1)
Api
(7)
Assembly Language
(2)
aws
(29)
Azure
(10)
BI
(10)
Books
(262)
Bootcamp
(11)
C
(78)
C#
(12)
C++
(83)
Course
(87)
Coursera
(300)
Cybersecurity
(30)
data
(5)
Data Analysis
(32)
Data Analytics
(22)
data management
(15)
Data Science
(353)
Data Strucures
(17)
Deep Learning
(158)
Django
(16)
Downloads
(3)
edx
(21)
Engineering
(15)
Euron
(30)
Events
(7)
Excel
(19)
Finance
(10)
flask
(4)
flutter
(1)
FPL
(17)
Generative AI
(72)
Git
(10)
Google
(51)
Hadoop
(3)
HTML Quiz
(1)
HTML&CSS
(48)
IBM
(42)
IoT
(3)
IS
(25)
Java
(99)
Leet Code
(4)
Machine Learning
(292)
Meta
(24)
MICHIGAN
(5)
microsoft
(11)
Nvidia
(8)
Pandas
(14)
PHP
(20)
Projects
(32)
pytho
(1)
Python
(1328)
Python Coding Challenge
(1132)
Python Mistakes
(51)
Python Quiz
(490)
Python Tips
(5)
Questions
(3)
R
(72)
React
(7)
Scripting
(3)
security
(4)
Selenium Webdriver
(4)
Software
(19)
SQL
(49)
Udemy
(18)
UX Research
(1)
web application
(11)
Web development
(8)
web scraping
(3)

0 Comments:
Post a Comment