0
 import java.util.Scanner;
public class Main
{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    /*when you have to declare your class and you have create the object of the class then syntex is:className_objectName = new classname()*/
    System.out.println("Enter your age");   
    int age = sc.nextInt();
    System.out.println("Your age is: " + age);
    System.out.println("Enter your weight");
    float weight = sc.nextFloat();
    System.out.println("Your age weight: " + weight);
    System.out.print("Enter your Name");
    String name = sc.nextLine();
    System.out.println("Your name is: " + name);
    
    }
}

programe over

when we run this programe this Stirng name = sc.nextLine not taking input from system and execute next line of code. when we debug this code it's shows this in debug console;enter image description here

Joachim Sauer
  • 278,207
  • 54
  • 523
  • 586

0 Answers0