JAVA SP T


Lets dive into snapshot of my programs!💻

2.How to convert int to String..

💡Code:

 public class IntToStringConversion7078 {
              public static void main(String[] args) {
                  // Example int
                  int number = 123;
          
                  // Convert the int to a String
                  String convertedString = convertIntToString(number);
          
                  // Print the converted String
                  System.out.println("Converted String: " + convertedString);
              }
          
              // Function to convert an int to a String
              private static String convertIntToString(int num) {
                  // Use String.valueOf() to convert the int to a String
                  return String.valueOf(num);
              }
          }
          
           

📸Output :

output