- 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 Integers and a String
To concatenate integers with a string value, you need to use the + operator.
Let’s say the following is the string.
String str = "Demo Text";
Now, we will concatenate integer values with the above string.
String res = str + 1 + 2 + 3 + 4 + 5;
Example
public class Demo { public static void main(String[] args) { String str = "Demo Text"; System.out.println("String = "+str); String res = 99 + 199 + 299 + 399 + str; System.out.println(res); } }
Output
String = Demo Text 996Demo Text
Advertisements