Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Concatenate null to a string in Java
To concatenate null to a string, use the + operator.
Let’s say the following is our string.
String str = "Demo Text";
We will now see how to effortlessly concatenate null to string.
String strNULL = str + "null";
The following is the final example.
Example
public class Demo { public static void main(String[] args) { String str = "Demo Text"; System.out.println("String = "+str); String strNULL = str + "null"; System.out.println("String concatenated with NULL: "+strNULL); } }
Output
String = Demo Text String concatenated with NULL: Demo Textnull
Advertisements
