|
-
Nov 24th, 2000, 06:58 PM
#1
Thread Starter
Dazed Member
Does anyone know how i can get System.in to work.
Ive done this before in C++ by just using cin <<
but i cant seem to get it to work in Java.
import java.io.*;
class menu{
public static void main(String args[]){
int choice = 0;
for(; {
System.out.println(" ");
System.out.println("Press 1 to say Hi");
System.out.println("Press 2 to say Hello");
System.out.println(" ");
System.out.println("Enter a choice: ");
System.in(choice); // dosent seem to work
break;}
switch(choice){
case '1':
System.out.println("Your choice is 1");
break;
case '2':
System.out.println("Your choice is 2");
break;
default:
System.out.println("You must enter in a choice");
break;
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|