+ 1
Why this input does not work?
14 RĂ©ponses
+ 2
After the correction Sakshi told you to do, please write the printing statement as :- System.out.println("Enter your name " + name);
+ 2
https://code.sololearn.com/c5i6nlR8oCpa/?ref=app
I hope now you understand it
+ 1
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner=new Scanner (System .in);
String name;
int age;
float shoe;
System.out.println ("enter your name");
name=scanner.nextLine();
}
}
This is right code now see your mistake and correct it
+ 1
So what should I do to make it work?
0
But when you run my code it works? Cause I don't see any difference
0
Your code is not running it gives mistake in print statement and then it gives you again error in import package.
0
I already correct your code see above and see your mistake with understand and then write
0
It just print "enter your name"
0
Your code don't show errors but don't work either
0
Input the name, age and shoe and don't mind but please learn Java
0
I am learning but looks like with solo learn my codes won't run
0
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner=new Scanner (System .in);
String name;
int age;
float shoe;
System.out.println ("enter your name");
name=scanner.nextLine();
}
}
0
No . It will still not show you the name which you will input . For that , you need to assign the variable "name" in your printing statement. Please write:- ("enter your name " + name).
You have not written "+ name"; so the value which you will assign, won't print as it is not there in the statement