Directions from the book - Write a method named showChar . The method should acc
ID: 3761716 • Letter: D
Question
Directions from the book - Write a method named showChar. The method should accept two arguments; a reference to a Stringobject and an integer. The integer argument is a character position within the String, with the first character being at position 0. Here is an example of a call to the method:
showChar("New York", 2);
-The showChar method should accept two arguments.
-Display the String valued entered, the position requested and the character found in that position, with descriptive labels.
-Use the @param to describe the parameters
Explanation / Answer
void showChar(String s,int index){
System.out.println(“Character at position “+index + “ of string is “+s.charAt(index));
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.