Write a Java program that checks whether the given string contains only digits (ASCII characters 0-9) and
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a Java program that checks whether the given string contains only digits (ASCII characters 0-9) and returns true or false. You must include a simple constructor and perform your core counting logic in a class method named OnlyDigits (not in main). Test your program with the given strings: "95784846896" "301 860 4000" "9A48@9Z96" Hint: You may use the Java Character.isDigit() or String.matches() methods.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: