bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java Scanner useRadix() Method

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java Scanner useRadix() Method?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

// ___ a scanner object Scanner myObj = new Scanner("FFAD01");
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The useRadix() method changes the radix used by the scanner.
Definition and Usage
Java Scanner useRadix() Method

❮ Scanner Methods

Read a hexadecimal number

// Create a scanner object Scanner myObj = new Scanner("FFAD01");
// Change radix myObj.useRadix(16);
// Read and display the number System.out.println(myObj.nextInt());

Definition and Usage

The useRadix() method changes the radix used by the scanner. The radix specifies how many different symbols can be used to represent each digit in a number. For example, a radix of 16 would allow the symbols 0 to 9 and A to F to be used as digits.

Syntax

public Scanner useRadix(int
radix )

Parameter Values

ParameterDescription
radixRequired. An int value specifying the radix that the scanner will use to interpret whole numbers.

Technical Details

Returns:A reference to the Scanner object that this method belongs to, which allows for chaining configuration methods. An example of chaining is myObj.useRadix(16).useDelimiter(","); .

❮ Scanner Methods

Previous

Java Scanner useLocale() Method

Next

Java File Class Methods