Java Scanner useRadix() MethodThe useRadix() method of Java Scanner class is used to set the default radix of the Scanner which is in using to the specified radix. SyntaxFollowing is the declaration of useRadix() method: Parameter
ReturnsThe useRadix() method reurns this Scanner object. ExceptionsIllegalArgumentException- It will thrown exception if the radix is out of range. Compatibility VersionJava 1.5 and above Example 1Output: 1 2 3 4 Example 2Output: String: Facebook.com 11 + 11 = 22.0 true New radix: 32 Example 3Output: If the Radix is less than Character.MIN_RADIX or greater than Character.MAX_RADIX, then an IllegalArgumentException will be thrown. Exception in thread "main" java.lang.IllegalArgumentException: radix:235 at java.base/java.util.Scanner.useRadix(Scanner.java:1353) at myPackage.ScannerUseRadixExample3.main(ScannerUseRadixExample3.java:9) Next TopicJava-scanner-tokens-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India