 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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 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
Advertisements
 