![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Sep 2006
Posts: 8
Rep Power: 0
![]() |
Whats wrong with newb code?
import java.io.* ;
public class life42 {
private static BufferedReader stdin = new BufferedReader (
new InputStreamReader ( System.in) ) ;
public static void main (String[] args) {
System.out.println( "Enter a number") ;
String input = stdin.readLine();
int a = Integer.parseInt ( input) ;
if ((a !<= 0 || a !>= 0)) {
System.out.println("Maybe if you enter a number..") ;}
while ( a <= 0 || a >= 0) {
System.out.println ("Input a number") ;
input = stdin.readLine();
a = Integer.parseInt(input) ;
System.out.println(a) ;
}
if (a == 42) {
System.exit;
}
}
}Im doing aome programming exercises. This one is supposed to accept input and output. It prints the number and closes when 42 is entered. Looks good to me, but it wont let me compile gives some ridiculous error messages. Any help? |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is wrong with this code? | c0ldshadow | Visual Basic .NET | 5 | Dec 5th, 2005 5:37 PM |
| How to post a question | nnxion | C++ | 10 | Jun 3rd, 2005 11:53 AM |
| How to post a question | nnxion | C++ | 0 | Jun 3rd, 2005 8:55 AM |
| How to post a question | nnxion | C | 0 | Jun 3rd, 2005 8:55 AM |
| Any ideas what i've done wrong? (Newb C Programmer) Code included | Ramlag | C++ | 10 | Mar 22nd, 2005 1:57 PM |