Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Do a google search for the Java documentation on the Character class. Make sure

ID: 3565278 • Letter: D

Question

Do a google search for the Java documentation on the Character class. Make sure you have found the documentation from the Oracle site.

1. How would use the method isDigit( ) in a statement to see if the char variable x is a digit or
not?
char x;
boolean xIdDigit = ___________________________;

Do a google search for the String class.
2. What do the methods startsWith and endsWith do? Write an example statement showing
how to use one of the methods.

3. How many version of the method indexOf are there ? This is an example of an overloaded
method

Explanation / Answer

1. How would use the method isDigit( ) in a statement to see if the char variable x is a digit or
not?
char x;
boolean xIdDigit = __isDigit(x)_________________________;

Do a google search for the String class.
2. What do the methods startsWith and endsWith do? Write an example statement showing
how to use one of the methods.
startsWith() takes two arguments, the string to check for, and the offset (beginning at 0) to begin that test at.
Such as:
String str = "Hey there";
System.out.println(str.startsWith("Hey")); //prints true
System.out.println(str.startsWith("there"));//prints false
System.out.println(str.startsWith("there",4));//prints true

endsWith() does the same thing, only it compares from the back fowards, and takes no offset argument
String str = "Hey there";
System.out.println(str.endsWith("the"));//returns false
System.out.println(str.endsWith("there"));//returns true

3. How many version of the method indexOf are there ? This is an example of an overloaded
method

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote