Java Scanner hasNextBigDecimal() MethodThe hasNextBigDecimal() is a method of Java Scanner class which is used to check if the next token in this scanner's input can be interpreted as a BigDecimal using the nextBigDecimal() method or not. It returns true if the scanner's input can be interpreted as a BigDecimal, otherwise returns false. SyntaxFollowing is the declaration of hasNextBigDecimal() method: ParameterThis method does not accept any parameter. ReturnsThe hasNextBigDecimal() method returns true if and only if this scanner's next token is a valid BigDecimal. ExceptionsIllegalStateException Compatibility VersionJava 1.5 and above Example 1Output: Result: false String: JavaTpoint.com Example 2Output: Result: true String Value: 4564.00 Example 3Output: false Hello false JavaTpoint! true 13 false + true 13.0 false = true 26 Next TopicJava-scanner-hasnextbiginteger-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