import java.util.scanner;
public class helloworld {
public static void main(string[] args) {
scanner keyboard = new scanner(system.in);
system.out.println("choose number between 1 , 10");
if (keyboard == 1) { system.out.println("you correct");
} else system.out.println("sorry try again");
}
}
says can not have (keyboard == 1) tried declare keyboard int received error how make if types 1 on keyboard run command?
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/scanner.html
@ hasnextint() , nextint(). need pull value scanner, compare value 1 or "1" or whatever. comparing scanner object 1 doesn't make sense.
-lee
Forums Macs Mac Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment