trim() method and toUpperCase()

Hi there,

I am trying to figure out how to use the trim and toUpperCase Methods in Java. I looked up the methods on the internet, but when I try to implement them in my code it doesn't work. I am not sure if I need to import a class? Please see the code below ( I commented out the code for trim and toUpperCase).

Thanks ........

////////////////////code///////////////////////////

/*

* Main.java

*

* Created on February 17, 2007, 12:27 AM

*

* To change this template, choose Tools | Template Manager

* and open the template in the editor.

*/

package temp;

import java.util.*;

import java.lang.*;

/**

*

* @author dwilmes

*/

public class Main

{

public static Scanner in = new Scanner(System.in);

/** Creates a new instance of Main */

public Main()

{

}

/**

* @param args the command line arguments

*/

public static void main(String[] args)

{

char userInput = '\0';

userInput = menu(userInput);

switch (userInput)

{

case 'B':

break;

case 'R':

break;

case 'I':

break;

case 'D':

break;

default:

System.out.println("That's not A, B, or C!");

}

}

private static char menu(char userInput)

{

while(userInput != 'Q')

{

System.out.println("\n\nPlease input:\n" +

"B (Box)\n" +

"R (Rigth Triangle)\n" +

"I (Isosceles Triangle)\n" +

"D (Diamond)\n" +

"Q (Quit)");

userInput = in.nextLine().charAt(0);

//userInput = userInput.in.trim();

//userInput = userInput.in.toUpperCase();

}

return userInput;

}

}

[1807 byte] By [megorea] at [2007-11-26 18:46:08]
# 1
userInput = userInput.trim();userInput = userInput.toUpperCase();Kaj
kajbja at 2007-7-9 6:20:02 > top of Java-index,Java Essentials,New To Java...
# 2
Hmmm...I took out the in, but it says now as an error that a char can not be dereferenced. I am not sure what that means? Thanks for the reply.
megorea at 2007-7-9 6:20:02 > top of Java-index,Java Essentials,New To Java...
# 3
use code tags!userInput = in.nextLine().toUpperCase().trim().charAt(0);
mlka at 2007-7-9 6:20:02 > top of Java-index,Java Essentials,New To Java...
# 4
> Hmmm...I took out the in, but it says now as an error> that a char can not be dereferenced. I am not sure> what that means? Thanks for the reply.you are attempting to use a char (a primitive). Primitives do not have methods.
mlka at 2007-7-9 6:20:02 > top of Java-index,Java Essentials,New To Java...