Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The integer argument is a character position within the String, with the first character being at position 0. When the method executes, it should display the character at that character position in that string. Here is an example of a call to the method: showChar(“New York”, 2); In this call, the method will display character w because it is in position 2. Demonstrate the method in a complete program. Read a string and a integer from the user. Your program should work for any string and any character position within the staring. IN JAVA
Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The integer argument is a character position within the String, with the first character being at position 0. When the method executes, it should display the character at that character position in that string. Here is an example of a call to the method:
showChar(“New York”, 2);
In this call, the method will display character w because it is in position 2. Demonstrate the method in a complete program. Read a string and a integer from the user. Your program should work for any string and any character position within the staring.
IN JAVA
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images