Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a Java Program to convert int type variables to String
PROGRAM:Java Program to convert int type variables to String
/*Java Program to convert int type variables to String*/
1: Java Program to Convert int to string using valueOf()
class Main {
public static void main(String[] args) {
// create int variable
int num1 = 36;
int num2 = 99;
// convert int to string
// using valueOf()
String str1 = String.valueOf(num1);
String str2 = String.valueOf(num2);
// print string variables
System.out.println(str1); // 36
System.out.println(str2); // 99
}
}
2: Java Program to Convert int to string using toString()
class Main {
public static void main(String[] args) {
// create int variables
int num1 = 476;
int num2 = 78656;
// convert int to string
// using toString()
String str1 = Integer.toString(num1);
String str2 = Integer.toString(num2);
// print string variables
System.out.println(str1); // 476
System.out.println(str2); // 78656
}
}
3: Java Program to Convert int to String using + Operator
class Main {
public static void main(String[] args) {
// create int variables
int num1 = 3476;
int num2 = 8656;
// convert int to string
// using + sign
String str1 = “” + num1;
String str2 = “” + num2;
// print string variables
System.out.println(str1); // 3476
System.out.println(str2); // 8656
}
}
4: Java Program to Convert int to String using format()
class Main {
public static void main(String[] args) {
// create a int variable
int num = 9999;
// convert int to string using format()
String str = String.format(“%d”, num);
System.out.println(str); // 9999
}
}