How to convert String to Integer in java

how-to-convert-string-to-integer-in-java

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);
    }   
}


Total
0
Shares
Leave a Reply

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

Previous Post
solid-in-react-ocp-–-open-closed-principle

SOLID in React- OCP – Open-Closed Principle

Next Post
dark-mode-in-3-lines-of-css-and-other-adventures

Dark Mode in 3 Lines of CSS and Other Adventures

Related Posts