Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Java code error: One curly brace is missing

    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 416
    Answer it

    Following is my code- 

    import java.util.Scanner;
    public class Sample {
    public static void main (String [] args){
    Scanner myObj = new Scanner (;
    System.out.println(Hello.Do you want to check your cuteness percentage?");
    String answer = myObj.nextLine();
    if (answer.equals ("Yes") ){
    System.out.println("Welcome. Your name:");
    } if else (answer.equals ("No") ) {
    }else {
    System.out.println("Please enter yes or no");
    String subAnswer = myObj.nextLine ();
    System.out.println("Your age");
    int lastAnswer = myObj.nextInt ();
    if (subAnswer.equals ("Shruti") && lastAnswer == 18 ){
    System.out.println(subAnswer +"-you're cuteness is 29%");
    }else if (subAnswer.equals ("Rudra") && lastAnswer==12) {
    System.out.println(subAnswer +"-you're 30% cute");
    } else if (subAnswer.equals ("Swati")&& lastAnswer==1) {
    System.out.println(subAnswer+"-you're 2% cute");
    System.out.println("No cuteness ");

    This is my program and l want that when it asks the first question, and the user answers yes then it will say welcome and continue asking name and age. When user answers no, it says ok and no ask name and age and if user says something else then it will say please answer yes or no. But when l compile and try to run it, it says error= that one curly brace is missing ("reached the end of the file while phrasing")^{. 

    Please help me...

 0 Answer(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: