return a param to main method then using switch

Hi there,

I am trying to call on a method, and define a parameter to be passed back up to the main method. From there I am trying to use a switch statement to print out different messages. However, the param is never passed back to the main. Below is the code. If anyone has any ideas please let me know.

Thanks much....

/////////////////////////////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.Scanner;

/**

*

* @author dwilmes

*/

public class Main

{

/** Creates a new instance of Main */

public Main()

{

}

/**

* @param args the command line arguments

*/

public static void main(String[] args)

{

char number = '\0';

menu(number);

System.out.println("you are in main the value of number is " + number);

switch (number)

{

case 'A':

System.out.println("You entered A.");

break;

case 'B':

System.out.println("You entered B.");

break;

case 'C':

System.out.println("You entered C.");

break;

default:

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

}

}

private static char menu(char number)

{

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter A, B, or C: ");

number = keyboard.nextLine().charAt(0);

System.out.println("you are in menu method the value of number is " + number);

return number;

}

}

[1751 byte] By [megorea] at [2007-11-26 18:44:52]
# 1
> However, the param is never passed back to the main.Of course it is. But in your main method, you never assign the result of the method to anything, so you ignore it. Try this instead:number = menu(number);
DrClapa at 2007-7-9 6:18:46 > top of Java-index,Java Essentials,New To Java...
# 2
That worked. I am very new at Java or actually writing any language. Thank you very much. Is there a way I could improve this code? I am sure there is, but I don't know how.Thanks...
megorea at 2007-7-9 6:18:46 > top of Java-index,Java Essentials,New To Java...