![]() |
| | |||||||
| Programming & Design Programming & Design |
| | LinkBack | Thread Tools | Display Modes |
| |||
| I'm trying to write a Java Program, but I don't know what I'm doing wrong?
I am trying to implement a Java program that displays the following text menu: 0-Exit 1-Compute the sum of some numbers 2-Compute the product of some numbers Here is the code. What am I doing wrong?? When I try to compile it, I get several error messages. import java.io.*; public class p2 { private static BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) ); public static void main ( String [] args ) throws IOException { System.out.println( "0-Exit" ); System.out.println( "1-Compute the sum of some numbers" ); System.out.println( "2-Compute the product of some numbers" ); String input = stdin.readLine(); switch(input) { case "0": break; case "1": break; case "2": break; default: System.out.println( "Invalid Selection" ); break; } System.out.println( "Bye Bye" ); } } |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Algorithm:write a java program to generate and print the first n numbers of a... | cinderella | Programming & Design | 0 | 04-09-2008 09:51 AM |
| how to write a program in Java to write the following? | Ayman Safi | Programming & Design | 0 | 04-09-2008 07:34 AM |
| please anyone know how to write this program in java programing. pleas give me... | Kim C | Programming & Design | 0 | 04-06-2008 09:17 AM |
| do anyone know how to write this program in java programing? i some help for... | bostun_mpw | Programming & Design | 0 | 04-06-2008 05:48 AM |
| hey do anyone know how to write this program in java programing. i need some out | bostun_mpw | Programming & Design | 0 | 04-06-2008 05:40 AM |