Answer:
The method in Java is as follows:
public static String returnlen(String input){
String output = ""+input.charAt(0)+input.charAt(input.length()-1);
return output;
}
Explanation:
This defines the method
public static String returnlen(String input){
This concatenates the first and the last character of the input string
String output = ""+input.charAt(0)+input.charAt(input.length()-1);
This returns the concatenated string
return output;
}
Answer:
II and III
Explanation:
In the snippets of code provided the only ones that will evaluate to true will be conditions II and III. Condition one has and (&&) comparisons meaning that every single condition needs to be true in order for the overall condition to be true, if only two variables are guaranteed to be equal then the third variable could be different which would ultimately evaluate to false. Condition 2 has or (||) comparison meaning only one needs to be true in order for the overall condition to be true and since we are already told that at least two are equal then it will always evaluate as true. Condition 3 is an arithmetic problem that will always equal 0 because two of the variables are equal, meaning that when they subtract it will give 0, and anything multiplied by 0 will equal 0 as well. Therefore, evaluating to true.