0
import java.io.StringReader;
import java.util.Scanner;

public class takeinput {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        float db = sc.nextFloat();
        String st  = sc.nextLine();

        System.out.println("String: " + st);
        System.out.println("Double: " + db);
        System.out.println("Int: " + i);
    }
}

If I remove all the int and float and then run for string, it works fine then, but not in this code. What should I do ?

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95

0 Answers0