How to convert String to Integer in java

April 29, 2023


for explanation watch the video



import java.util.*;
import java.lang.*;
class Demo{
    public static void main(String[] args){
        String s = "9999";
        int num1 = Integer.parseInt(s);
        System.out.println(num1);
        int num2 = Integer.valueOf(s);
        System.out.println(num2);
    }   
}


Enter fullscreen mode

Exit fullscreen mode



Source link

Comments 0

Leave a Reply

Your email address will not be published. Required fields are marked *