Question: Given the following variables, find methods that answer the following questions. Make sure each answer is a line of code that would actually run. Example:
Given the following variables, find methods that answer the following questions. Make sure each answer is a line of code that would actually run. Example: Find a method in the String class that checks the length of s1. Answer: int length-s1.length0: //this answer is a line of code that would actually run Note: You may name the variable that holds your return value (in the example I named it length) anything you like. String s1="seashells" String s2="basketball" int n=3; int n1-4; char letter-'p; char c1-'d; 1) Find a method in the String class that checks if the last letter of s1 is s. 2) Find a method in the String class that checks if the first letter of s2 is b 3) Find a method in the String class that converts s2 into an array of chars. 4) Find a method in the Character class that converts variable letter into an uppercase letter. 5) Find a method in, the Character class that tells us if c1 is uppercase or not. 6) Find a method in the Math class that tells us which is larger: n or n1. 7) Find a method in the Math class that tells us which is smaller: n or n1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
