Can anyone help me with the below code, it only ask for int and float, but it doesn't ask for string:
package day1.example;
import java.util.Scanner;
public class ExampleInput {
private static Scanner obj;
public static void main(String[] args) {
obj = new Scanner(System.in);
int a;
float b;
String c;
System.out.println("Enter a No : ");
a = obj.nextInt();
System.out.println("a = " + Math.pow(a,2));
System.out.println("Enter a Float : ");
b = obj.nextFloat();
System.out.println("b = " + b);
System.out.println("Enter a String :");
c = obj.nextLine();
System.out.println("Name = " + c);
}
}
Any help would be appreciated.