-4

public static void main(String[] args) { Scanner input = new Scanner(System.in);

System.out.println("Enter your expected salary : ");
Double salary = input.nextDouble();
System.out.println("Enter your age : ");
Short age = input.nextShort();
System.out.println("Are your from Bangladesh? ");
Boolean isTrue = input.nextBoolean();   
System.out.println("Share your weakness : ");
String weakness = input.nextLine();
System.out.println("Salary : " + salary);
System.out.println("Age : " + age);
System.out.println("Nationality : " + isTrue);
System.out.println("Weakness : " + weakness);

}

  • Hello. To clarify your question/problem use [edit] option. Please note that purpose of this site is to gather programming questions and answers so others facing same problem could *find* them. Question without *clear/specific* problem description: like error message, exception stack trace, or actual vs expected behavior, would be nearly impossible to find for people facing same problem. To help others help you always provide reasonable amount of information about problem you are facing (just like when you go do a doctor you don't only show your leg, you also tell where it hurts and when). – Pshemo Jun 04 '22 at 19:31
  • 1
    For instance this question has nice description of problem you are trying to solve: [Scanner is skipping nextLine() after using next() or nextFoo()?](https://stackoverflow.com/q/13102045) – Pshemo Jun 04 '22 at 19:35

0 Answers0