"Write and test the method that returns a letter of the alphabet from a given word, it the position is given. (Hint: use the method that begins with static char getLetter (String txt, int n)."
I've been staring at this question for 20 minutes, can't seem to understand what it wants me to do.
This is what I have so far:
// The "Divide_raminAmiri" class.
public class Divide_raminAmiri
{
public static void main (String[] args)
{
String word;
int location;
System.out.println ("Enter a word.");
word = In.getString ();
System.out.println ("Enter the location of the letter.");
location = In.getInt ();
} // main method
public static void test (char c)
{
System.out.println (word.charAt (location));
}
} // Divide_raminAmiri class
I'm confused. I think what it wants me to do is use methods to find the letter at the location provided, but I'm getting errors. Any help appreciated!