Java Scanner.radix()

Syntax

Scanner.radix() has the following syntax.

public int radix()

Example

In the following code shows how to use Scanner.radix() method.


import java.util.Scanner;
//from w  ww  .  j a v a  2s .c om
public class Main {

   public static void main(String[] args) {

      String s = "java2s.com 1 + 1 = 2.0 true ";

      Scanner scanner = new Scanner(s);

      System.out.println(scanner.nextLine());

      // print the default radix
      System.out.println(scanner.radix());

      scanner.close();
   }
}

The code above generates the following result.