
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Related Questions & Answers
- Java Program to Concatenate String.
- Java Program to concatenate a String and Integers
- Java Program to concatenate Integers and a String
- Concatenate string to an int value in Java
- remove null value from a String array in Java
- How to concatenate variable in a string in jQuery?
- How to concatenate a string with numbers in Python?
- How to concatenate numerical vectors and a string to return a string in R?
- Display and concatenate records ignoring NULL values in MySQL
- Java Program to Check if a String is Empty or Null
- How to concatenate lists in java?
- Concatenate string with numbers in MySQL?
- How to concatenate multiple string variables in JavaScript?
- What is the preferred way to concatenate a string in Python?
- How to concatenate a std::string and an int in C++?
Advertisements