Java API Tutorial - 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 w  w .j av a 2 s .co m
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.