I need to do create the following programs, with more than one header. A main he
ID: 3633611 • Letter: I
Question
I need to do create the following programs, with more than one header. A main header, then two or more different headers (public class)Write a Java program that includes a method named showChar. The method accepts two arguments: the first argument is a String and the second argument is a number represents a character position within the String. When the method executes, it should return the character at that character position. Your main method will do the following:
prompt the user to input a String and a character position.
Then call the method to get the character at the position the user entered.
display the result.
Explanation / Answer
This didn't work for me i got the following errors:
error: unclosed string literal
System.out.println("Character at position "+pos+"
error: ';' expected
System.out.println("Character at position "+pos+"
error: illegal start of expression
is:"+val.charAt(pos));
error: unclosed string literal
is:"+val.charAt(pos));
^
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.