How to convert string to int (integer) in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String str = "9482";
        int n = Integer.parseInt(str);

        System.out.println(n);
    }
}
  
  
  
/*
run:
  
9482
  
*/

 



answered Jun 4, 2021 by avibootz

Related questions

2 answers 316 views
1 answer 250 views
2 answers 381 views
381 views asked Jan 2, 2022 by avibootz
1 answer 250 views
1 answer 304 views
1 answer 1,017 views
...