Java parseInt explains plus method examples

  • 2020-04-01 02:28:03
  • OfStack

      Java parseInt ()
                                            Grammar:     Static int parseInt (String s)
                                                        Static int parseInt(String s, int radix)
                                          Parameter: String s: represents the representation of a decimal String
                                                          Int radix: converts a string to an integer
                                            For example: int c= integer.parseint ("12",8); That means that the 12 in double quotes is an octal number, which is binary 1010, and the decimal number is 10
                  Application examples:

              public class Test{ 
                  public static void main(String args[]){
                  int x =Integer.parseInt("9");
                  double c = Double.parseDouble("5");
                  int b = Integer.parseInt("444",16);
                  System.out.println(x);
                  System.out.println(c);
                   System.out.println(b);
             }
         } 
 
         
              Operation results:
                    9
                  5.0
                1092

Related articles: