title: Multiple compiler errors in my quiz program
body: <p>This is a java program for making a quiz and you have 10 questions and if you get one answer correct you will get 1 point however there is no negative marking and when I compile it it throws this: 'else' without 'if' error</p>
  
  <pre><code>import java.util.Scanner;
  
  /**
   * Write a description of class program1 here.
   * 
   * @author (your name) 
   * @version (a version number or a date)
   */
  public class Project
  {
      public static void main(String[]args)
      {
          Scanner sc = new Scanner(System.in);
          char ans;
          int score=0;
  
          System.out.println("1.What was the first mouse created?");
          System.out.println("(a)Glass ");
          System.out.println("(b) Wood");
          System.out.println("(c) Steel");
          System.out.println("(d) Paper");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='b') {
              System.out.println("That's correct!");
              score+=1;
          }
          else {
  
              System.out.println("Sorry it is wrong...");
          }
  
  
  
          System.out.println("2. Who is the father of the 'Internet'?");
          System.out.println("(a)Alan Peris ");
          System.out.println("(c) Vint Cerf");
          System.out.println("(d) Steve Lawrence");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='c')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
  
          System.out.println("3.What search engine provides "instant answers" for certain types of queries?");
          System.out.println("(a)Google ");
          System.out.println("(b) Yahoo");
          System.out.println("(c) Bing");
          System.out.println("(d) Dogpile");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='c')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
  
  
          System.out.println("3.4K might be used synonymously with what acronym?");
          System.out.println("(a)UHD ");
          System.out.println("(b) VGA");
          System.out.println("(c) PCI");
          System.out.println("(d) HDR");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='a')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
  
  
          System.out.println("4. A zero day exploit is a type of what?");
          System.out.println("(a) Malware ");
          System.out.println("(b) Shareware");
          System.out.println("(c) Freeware");
          System.out.println("(d) Adware");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='a')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
  
  
  
          System.out.println("5.What adjective describes an image that only contains         shades of gray?");
          System.out.println("(a) Saturated ");
          System.out.println("(b) Grayscale");
          System.out.println("(c) Hueless");
          System.out.println("(d) Black and White");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='b')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
          System.out.println("6.What does it mean if a device is erg               onomic?");
          System.out.println("(a) It is upgradeable");
          System.out.println("(b) It is enviromentally friendly");
          System.out.println("(c) It is compatible with multiple               platforms");
          System.out.println("(d) It is designed to be comfortable to use");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='d')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
          System.out.println("7. Which of the following can be synced with iCloud?");
          System.out.println("(a) Reminders ");
          System.out.println("(b) Contacts");
          System.out.println("(c) Calendar");
          System.out.println("(d) Websites");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='d')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
  
  
          System.out.println("8.What is the term "Wi-Fi" short for?");
          System.out.println("(a) Wireless Fidelity");
          System.out.println("(b) Wireless Finder");
          System.out.println("(c) Wireless Frequency Inte                      lligence");
          System.out.println("(d) Nothing");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='d')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
          System.out.println("9. What do keystrokes measure?");
          System.out.println("(a) Login attempts");
          System.out.println("(b) Secure socket connections");
          System.out.println("(c) Keys pressed on a keyboard");
          System.out.println("(d) Nothing");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='c')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
  
  
  
          System.out.println("10.The veronica search engine is used to search what service?");
          System.out.println("(a) Gopher");
          System.out.println("(b) Telnet");
          System.out.println("(c) BBS");
          System.out.println("(d) FTP");
          System.out.print("Enter Your Choice =&gt; ");
          ans=sc.next().charAt(0) ;
          if(ans=='a')
              System.out.println("That's correct!");
          score+=1;
          else
  
              System.out.println("Sorry it is wrong...");
  
          System.out.println("Your total score is:"+score);
      }
  }
  }
  </code></pre>