Question
Modify the method you wrote in question 10 so it performs a caseinsensitive test. The method should return true if the argument ends with .com
Modify the method you wrote in question 10 so it performs a caseinsensitive test. The method should return true if the argument ends with .com in any possible combination of uppercase and lowercase letters.
method that i wrote for 10
public class methodIJustWrote { public static boolean DotCom(String input) { if (input.endsWith(".com")) { return true; } return false; }
public static void main(String[] args) { //Create a string object and initialize its value. String str = "Rachel12Green@live.com"; //If the value returned by the call to the function //endsWithDotCom() by passing the input string is //true, then display an appropriate message showing //that string ends with .com. if(DotCom(str)) { System.out.println("String " + str + " ends with \".com\"!"); } //Otherwise, display an appropriate message showing //that string doesn't end with .com. else { System.out.println("String " + str + " does not end with \".com\"!"); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started