Scanner radix() method in Java with Examples Last Updated : 11 Oct, 2018 Comments Improve Suggest changes Like Article Like Report The radix() method of java.util.Scanner class returns this scanner's default radix. Syntax: public int radix() Return Value: This function returns the default radix of this scanner. Below programs illustrate the above function: Program 1: Java // Java program to illustrate the // radix() method of Scanner class in Java import java.util.*; public class GFG1 { public static void main(String[] argv) throws Exception { String s = "Geeksforgeeks has Scanner methods"; // create a new scanner // with the specified String Object Scanner scanner = new Scanner(s); // print a line of the scanner System.out.println("Scanner String:\n" + scanner.nextLine()); // print the default radix System.out.println("Default Radix value: " + scanner.radix()); // close the scanner scanner.close(); } } Output: Scanner String: Geeksforgeeks has Scanner methods Default Radix value: 10 Program 2: Java // Java program to illustrate the // radix() method of Scanner class in Java import java.util.*; public class GFG1 { public static void main(String[] argv) throws Exception { String s = "Geeksforgeeks"; // create a new scanner // with the specified String Object Scanner scanner = new Scanner(s); // print a line of the scanner System.out.println("Scanner String: " + scanner.nextLine()); // print the default radix System.out.println("Default Radix value: " + scanner.radix()); // change the radix of this scanner scanner.useRadix(30); System.out.println("Radix changed to 30"); // print the default radix System.out.println("Default Radix value: " + scanner.radix()); // close the scanner scanner.close(); } } Output: Scanner String: Geeksforgeeks Default Radix value: 10 Radix changed to 30 Default Radix value: 30 Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#radix() Comment More infoAdvertise with us Next Article Scanner radix() method in Java with Examples gopaldave Follow Improve Article Tags : Java Java - util package Java-I/O Java-Functions Practice Tags : Java Similar Reads Scanner reset() method in Java with Examples The reset() method of java.util.Scanner class resets this scanner. On resetting a scanner, it discards all of its explicit state information which may have been changed by invocations of useDelimiter(java.util.regex.Pattern), useLocale(java.util.Locale), or useRadix(int). Syntax: public Scanner rese 2 min read Scanner nextInt() method in Java with Examples The nextInt(radix) method of java.util.Scanner class scans the next token of the input as a Int. If the translation is successful, the scanner advances past the input that matched. If the parameter radix is not passed, then it behaves similarly as nextInt(radix) where the radix is assumed to be the 5 min read Reader read() method in Java with Examples The read() method of Reader Class in Java is used to read a single character from the stream. This method blocks the stream till: It has taken some input from the stream. Some IOException has occurred It has reached the end of the stream while reading. This method is declared as abstract method. It 3 min read Scanner nextByte() method in Java with Examples The nextByte(radix) method of java.util.Scanner class scans the next token of the input as a Byte. If the translation is successful, the scanner advances past the input that matched. If the parameter radix is not passed, then it behaves similarly as nextByte(radix) where the radix is assumed to be t 5 min read Scanner nextLong() method in Java with Examples The nextLong(radix) method of java.util.Scanner class scans the next token of the input as a long. If the translation is successful, the scanner advances past the input that matched. If the parameter radix is not passed, then it behaves similarly as nextLong(radix) where the radix is assumed to be t 5 min read Scanner nextShort() method in Java with Examples The nextShort(radix) method of java.util.Scanner class scans the next token of the input as a short. If the translation is successful, the scanner advances past the input that matched. If the parameter radix is not passed, then it behaves similarly as nextShort(radix) where the radix is assumed to b 5 min read Scanner nextFloat() method in Java with Examples The nextFloat() method of java.util.Scanner class scans the next token of the input as a Float(). If the translation is successful, the scanner advances past the input that matched. Syntax: public float nextFloat() Parameters: The function does not accepts any parameter. Return Value: This function 4 min read Scanner nextDouble() method in Java with Examples The nextDouble() method of java.util.Scanner class scans the next token of the input as a Double. If the translation is successful, the scanner advances past the input that matched. Syntax: public double nextDouble() Parameters: The function does not accepts any parameter. Return Value: This functio 4 min read Scanner nextBigDecimal() method in Java with Examples The nextBigDecimal() method of java.util.Scanner class scans the next token of the input as a BigDecimal. If the next token matches the Decimal regular expression defined above then the token is converted into a BigDecimal value as if by removing all group separators, mapping non-ASCII digits into A 4 min read Scanner nextBoolean() method in Java with Examples The nextBoolean() method of java.util.Scanner class scans the next token of the input as a Boolean. If the translation is successful, the scanner advances past the input that matched. Syntax: public boolean nextBoolean() Parameters: The function does not accepts any parameter. Return Value: This fun 4 min read Like