- 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 concatenate a String and Integers
To concatenate a String and some integer values, you need to use the + operator.
Let’s say the following is the string.
String str = "Demo Text";
Now, we will concatenate integer values.
String res = str + 1 + 2 + 3 + 4 + 5;
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 res = str + 1 + 2 + 3 + 4 + 5; System.out.println(res); } }
Output
String = Demo Text Demo Text12345
- Related Articles
- Java Program to concatenate Integers and a String
- Java Program to Concatenate String.
- Concatenate null to a string in Java
- Java Program to Concatenate Two Arrays
- C++ program to concatenate a string given number of times?
- Concatenate string to an int value in Java
- How to concatenate numerical vectors and a string to return a string in R?
- Java Program to multiply integers and check for overflow
- Java Program to add integers and check for overflow
- Java Program to subtract integers and check for overflow
- Java program to add two integers
- Java program to swap two integers
- How to extract multiple integers from a String in Java?
- Java program to split and join a string
- Java Program to subtract long integers and check for overflow

Advertisements