The assignment is Write a program that prompts the user to input a string and then outputs the string in uppercase letters. (Use an array of characters [or char] to store the string.)
I keep getting an error for my code cannot find symbol:
symbol : method toUpperCase()
location: class java.lang.String[]
System.out.println("n" + "The string converted to uppercase letters is " + (str.toUpperCase()));
My code for this is
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
String[] str = new String[30];
for (int index = 0; index < str.length; index++)
{
System.out.print("Please enter a string of characters with no spaces " + str.length);
str[index] = console.next();
System.out.println();
if (index < (str.length))
System.out.println();
}
System.out.println("n" + "The string converted to uppercase letters is " + (str.toUpperCase()));
}
}
What am I doing wrong?