0
How to write a simple java program with user input ?
taking the user input and then comparing the input and then printing the output using if statement
7 Answers
0
your code has x.nextint(); it should look like this x.nextInt(); "i" must be capital letter :)
+ 2
import java.util.*;
public class Program
{
public static void main(String[] args) {
int y;
Scanner x = new Scanner(System.in);
y = x.nextInt();
if(y == 30){System.out.println("Hello World");}
else{System.out.println("please enter 30");}
/*hope this helps tried to keep it as simple as possible for ya*/
0
https://code.sololearn.com/cMR7wbUi6Px8/?ref=app
is this code is correct?
0
yes theres nothing wrong with your code just capital the "i" for x.nextInt(); and it will run :)
0
which 'i'?
0
Thanks.
0
no problem