Create a String object with the string: IT 206 is a GREAT class!
Then, print out if the character at index 7 is a digit or not using one of the following messages:
Character is a digit! OR Character is not a digit!
// TestCode.java public class TestCode { public static void main(String[] args) { String s = "IT 206 is a GREAT class!"; if(s.charAt(7)>='0' && s.charAt(7)<='9'){ System.out.println("Character is a digit!"); } else{ System.out.println("Character is not a digit!"); } } }
String s = "IT 206 is a GREAT class!"; if(s.charAt(7)>='0' && s.charAt(7)<='9'){ System.out.println("Character is a digit!"); } else{ System.out.println("Character is not a digit!"); }
Get Answers For Free
Most questions answered within 1 hours.