How to check if a string contains a digit and return true in Java

String class in java represent character strings .Just like other constants Strings values cannot be changed.String objects  can be shared and they are immutable.Example of a  string in java

String str=”Eric loves programming”.

Today we are going to use different String class methods to write a method that returns true if a string contains a digit.

Using isDigit () and toCharArray () java methods

 


About the Author: Eric K

Kenyan Developer and Blogger with Interests in Java,Javascript,Node.js, Wordpress, Android, PHP and Making Money Online. Solving world problems through programming is my passion. Hire me: Email : kawi3462@gmail.com