- 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
Concatenate string to an int value in Java
To concatenate a string to an int value, use the concatenation operator.
Here is our int.
int val = 3;
Now, to concatenate a string, you need to declare a string and use the + operator.
String str = "Demo" + val;
Let us now see another example.
Example
import java.util.Random; public class Demo { public static void main( String args[] ) { int val = 3; String str = "" + val; System.out.println(str + " = Rank "); } }
Output
3 = Rank
- Related Articles
- Java Program to convert an int value to String
- How to concatenate a std::string and an int in C++?
- How to convert a String to an int in Java
- How to convert a Java String to an Int?
- Java Program to Concatenate String.
- Convert int to String in Java
- Convert String to Java int
- Concatenate null to a string in Java
- How to convert int to String in java?
- How to concatenate the string value length -1 in JavaScript.
- How to convert an int to string in C++?
- Java Program to convert a String to int
- Java Program to convert int to binary string
- Java Program to convert int to Octal String
- Java Program to convert mathematical string to int

Advertisements