Error in code, "illegal start of expression"

Lamb

I am making this game for a class, using BlueJ, and I have no idea what is wrong with this code.

I have tried changing the public static void at the bottom to a private and I even removed the if and else if statements to see if it would make any change but it didn't really accomplish anything.

By the way, the huge words in ASCII are for the game that I am making.

import java.util.Scanner;


public class Input
{

    public static void main(String[] args)
    {
        Scanner scanny = new Scanner(System.in); // scanner name is scanny fyi

        System.out.print("Press Enter to begin game"); //first message!

        String EnterPress = scanny.nextLine(); //varible for when you press enter

        System.out.println(" \n\n");
        pause(.3);
        System.out.println("        ./osyhhhhhhhhyso/-                                                                                                                                                                                .yyyyyyy.");
        pause(.3);
        System.out.println("     `/yhhhhhhhhhhhhhhhhhhy/`                                                                                                                                                                             .hhhhhhh-");
        pause(.3);
        System.out.println("    .yhhhhhhhhhyyyyhhhhhhhhhy.                                                                                                                                                                            .hhhhhhh-");
        pause(.3);
        System.out.println("   .hhhhhhhh+-``````./yhhhhhhh.                                                                                                                                                                           .hhhhhhh-");
        pause(.3);
        System.out.println("   yhhhhhhy.          `shhhhhhs                                                                                                                                                                           .hhhhhhh-");
        pause(.3);
        System.out.println("  :hhhhhhh-            .hhhhhhh.                                                                                                                                                                          .hhhhhhh-");
        pause(.3);
        System.out.println("  ohhhhhhh              yhhhhhh/                                                                                                                                                                          .hhhhhhh-");
        pause(.3);
        System.out.println("  yhhhhhhy              shhhhhh+                      ```             ``.```                                                 ``.``                      ``..``                       ``..``               .hhhhhhh-               ```.``");
        pause(.3);
        System.out.println("  hhhhhhhs              shhhhhh+       -sssssss   `:osyyy`       .:+syyyyyyyys+-`       +ssssss/         `sssssss-      `:+syyyyyyyo/.             `:+syyyyyyyys+:.             .:+syyyyyyyys+-`          .hhhhhhh-          `-+syyyyyyyys+:`");
        pause(.3);
        System.out.println(" `hhhhhhhs              `......`       -hhhhhhh``+yhhhhhh.     .oyhhhhhhhhhhhhhhy:      :hhhhhhy         -hhhhhhh`    `+yhhhhhhhhhhhhyo`         `+yhhhhhhhhhhhhhhy+`         .ohhhhhhhhhhhhhhhy:         .hhhhhhh-        `/yhhhhhhhhhhhhhhy+`");
        pause(.3);
        System.out.println(" `hhhhhhhs                             -hhhhhhh:yhhhhhhhh.    -yhhhhhhysooshhhhhhh/      yhhhhhh-        ohhhhhh+    `shhhhhhysooshhhhhy.       `shhhhhhysoosyhhhhhhs`       :hhhhhhhysosyhhhhhhh+        .hhhhhhh-       `shhhhhhysoosyhhhhhho");
        pause(.3);
        System.out.println(" `hhhhhhhs                             -hhhhhhhhhhyssossy`   `yhhhhhh/`   `.yhhhhhh.     /hhhhhho       `hhhhhhh.    +hhhhhh/`   `-yhhhhy`      ohhhhhho.    `+hhhhhh:      .hhhhhhh:`   `:hhhhhhh-       .hhhhhhh-       ohhhhhho.    `ohhhhhh/");
        pause(.3);
        System.out.println(" `hhhhhhhs                             -hhhhhhhho-`    ``    /hhhhhhs       :hhhhhh+     `yhhhhhh`      :hhhhhho     yhhhhhy       .hhhhh:     .hhhhhhh`      `hhhhhhs      ohhhhhh+       ohhhhhho       .hhhhhhh-      .hhhhhhh`      `hhhhhhy");
        pause(.3);
        System.out.println(" `hhhhhhhs                             -hhhhhhh:             shhhhhh/       .hhhhhhy      /hhhhhh:      ohhhhhh.     yhhhhhy`       +yso/.     :hhhhhhy        shhhhhh      yhhhhhh-       /hhhhhhh       .hhhhhhh-      /hhhhhhs        yhhhhhh.");
        pause(.3);
        System.out.println(" `hhhhhhhs       `++++++++++++++       -hhhhhhh`             hhhhhhh:       `hhhhhhh`     `hhhhhhs     `hhhhhhs      +hhhhhhy:`     ``         +hhhhhhs        shhhhhh      ///++++.       :hhhhhhh       .hhhhhhh-      ohhhhhho        shhhhhh:");
        pause(.3);
        System.out.println(" `hhhhhhhs       .hhhhhhhhhhhhhh       -hhhhhhh`             hhhhhhh:       `hhhhhhh`      +hhhhhh`    :hhhhhh-      `ohhhhhhhs:`              ohhhhhhs        ://////                    `/hhhhhhh       .hhhhhhh-      ohhhhhho        shhhhhh/");
        pause(.3);
        System.out.println(" `hhhhhhhs       .hhhhhhhhhhhhhh       -hhhhhhh`             hhhhhhhsoooooooohhhhhhh.      `hhhhhh/    shhhhhy        `/yhhhhhhhy/`            ohhhhhhs                              `.:+syhhhhhhhh       .hhhhhhh-      ohhhhhhyoooooooohhhhhhh/");
        pause(.3);
        System.out.println(" `hhhhhhhs        ......-hhhhhhh       -hhhhhhh`             hhhhhhhhhhhhhhhhhhhhhhh.       ohhhhhs   `hhhhhh/          .+yhhhhhhhy+.          ohhhhhhs                           .:oyhhhhhhhhhhhhh       .hhhhhhh-      ohhhhhhhhhhhhhhhhhhhhhh/");
        pause(.3);
        System.out.println(" `hhhhhhhs              `hhhhhhh       -hhhhhhh`             hhhhhhh+:::::::::::::::`       .hhhhhh.  /hhhhhy`            `/shhhhhhhy+.        ohhhhhhs                        `:ohhhhhhyo:/hhhhhhh       .hhhhhhh-      ohhhhhhs:::::::::::::::.");
        pause(.3);
        System.out.println(" `hhhhhhhs              `hhhhhhh       -hhhhhhh`             hhhhhhh:                        ohhhhh+  shhhhh+               `-shhhhhhhh/`      ohhhhhhs                       :yhhhhhho-`  :hhhhhhh       .hhhhhhh-      ohhhhhho");
        pause(.3);
        System.out.println("  hhhhhhhs              .hhhhhhh       -hhhhhhh`             hhhhhhh:                        -hhhhhy `hhhhhh`                  .+yhhhhhhs`     ohhhhhhs        .......       +hhhhhho.     :hhhhhhh       .hhhhhhh-      ohhhhhho");
        pause(.3);
        System.out.println("  yhhhhhhy              -hhhhhhh       -hhhhhhh`             hhhhhhh:       `+++++++`         shhhhh-/hhhhho                     .+hhhhhhs     ohhhhhhs        shhhhhh      /hhhhhho       :hhhhhhh       .hhhhhhh-      ohhhhhho        /++++++-");
        pause(.3);
        System.out.println("  +hhhhhhh.             +hhhhhhh       -hhhhhhh`             yhhhhhh:       `hhhhhhh`         -hhhhh+shhhhh.        `.:/os:        /hhhhhh:    +hhhhhhs        shhhhhh     `hhhhhhh-       :hhhhhhh       .hhhhhhh-      +hhhhhho        shhhhhh:");
        pause(.3);
        System.out.println("  .hhhhhhho            -hhhhhhhh       -hhhhhhh`             ohhhhhh/       .hhhhhhy           shhhhhhhhhhs         ohhhhhy`        hhhhhh/    -hhhhhhy        yhhhhhy     .hhhhhhh-       /hhhhhhh       .hhhhhhh-      -hhhhhhs        yhhhhhh-");
        pause(.3);
        System.out.println("   /hhhhhhho.        `:yhhhhhhhh       -hhhhhhh`             -hhhhhhy`      /hhhhhh+           :hhhhhhhhhh-         :hhhhhh+`      `hhhhhh:    `yhhhhhh-      .hhhhhh+     .hhhhhhhs`    .+hhhhhhhh`      .hhhhhhh-      `yhhhhhh-      .hhhhhhy");
        pause(.3);
        System.out.println("    ohhhhhhhhs+/:://oyhhhyohhhhh       -hhhhhhh`              ohhhhhhs:.``-+hhhhhhy`            yhhhhhhhhs           +hhhhhhs:.``.:yhhhhhs      :hhhhhhh/.``.:yhhhhhh.      shhhhhhhyo++shhyhhhhhhh`      .hhhhhhh-       :hhhhhhy/.``.:yhhhhhh:");
        pause(.3);
        System.out.println("     :yhhhhhhhhhhhhhhhhhs.:hhhhh       -hhhhhhh`              `ohhhhhhhhhhhhhhhhhy.             /hhhhhhhh:            /hhhhhhhhhhhhhhhhhs`       /hhhhhhhhhhhhhhhhhh:       `shhhhhhhhhhhhs`shhhhhh-      .hhhhhhh-        /hhhhhhhhhhhhhhhhhh:");
        pause(.3);
        System.out.println("      `/shhhhhhhhhhhhhy:  `hhhhh       -hhhhhhh`                -oyhhhhhhhhhhhhy/`              `hhhhhhhy              .+yhhhhhhhhhhhys:          .oyhhhhhhhhhhhhy+.         `/yhhhhhhhhy/` /hhhhhh/      .hhhhhhh-         .+yhhhhhhhhhhhhy+.");
        pause(.3);
        System.out.println("         `-/+ooosoo+:.     :::::       `:::::::                   `-:/+oooo+/:.                  +hhhhhh/                 .:/+ooo++:-`              `-:/+oooo+/:-`             `-/+oo+/-`   `::::::.      `:::::::`            .:/+oooo+/:-`");
        pause(.3);
        System.out.println("                                                                                                 +hhhhhh`");
        pause(.3);
        System.out.println("                                                                                          -://++shhhhhh:");
        pause(.3);
        System.out.println("                                                                                          ohhhhhhhhhhy:");
        pause(.3);
        System.out.println("                                                                                          ohhhhhhhyo:");                                                                                                                                                
        pause(.3);
        System.out.println("                                                                                          -//::-.`");            

        pause(5);

        System.out.println("\nyou begin as a man named Mason Grey, you are 30 years old, you went to college to learn how to become a detective, your parents are paying for your house, you were just fired from your job at the Police Station 1 month ago, and you have a girlfriend named Beth.");

        pause(7);

        System.out.println("\nyou arouse inside of a moving taxi");

        pause(1);

        System.out.println("\nwhat do you do?");

        pause(1.2);

        System.out.println("\nOption 1: Check your cellphone in your back pocket");

        pause(1.2);

        System.out.println("\nOption 2: Ask where you are");

        String A1 = scanny.nextLine();

        String B1 = scanny.nextLine();

        if (A1.equalsIgnoredCase ("Option 1") )
        {
            System.out.println("\nSuper long script");
        } else if (B1.equalsIgnoredCase ("Option 2") )
        {
            System.out.println("\nSecond super long script");
        }

        public static void pause(double secondsToPause) // **THIS IS WHERE THE ERROR IS, ON THE PUBLIC**
        {
        try
        {
            // type casting the resurt of the double times a long back into a long
            Thread.sleep((long)(1000*secondsToPause));
        }
        catch(InterruptedException ex)
        {
            Thread.currentThread().interrupt();
        }
    }
}


selbie

You are missing a closing bracket for the function definition of main.

Instead of this:

    if (A1.equalsIgnoredCase ("Option 1") )
    {
        System.out.println("\nSuper long script");
    } else if (B1.equalsIgnoredCase ("Option 2") )
    {
        System.out.println("\nSecond super long script");
    }

    public static void pause(double secondsToPause) // **THIS IS WHERE THE ERROR IS, ON THE PUBLIC**

This:

    if (A1.equalsIgnoredCase ("Option 1") )
    {
        System.out.println("\nSuper long script");
    } else if (B1.equalsIgnoredCase ("Option 2") )
    {
        System.out.println("\nSecond super long script");
    }
}  // <== YOU ARE MISSING THIS

public static void pause(double secondsToPause) // **THIS IS WHERE THE ERROR IS, ON THE PUBLIC**

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

error: illegal start of expression in Android Studio Code

Error code compiling: illegal start of expression

I keep getting an "illegal start of expression" error on my code

error: illegal start of expression in my Android studio code

Java Error: illegal start of expression

Compile Error: illegal start of expression

"Illegal start of expression" error in Java

java illegal start of expression error

Receiving Illegal start of expression error

Illegal start of expression error in Java

Weird "illegal start of expression" error in Netbeans

javac strange syntax - error illegal start of expression

Error: illegal start of expression followed by PriorityQueue

How to fix illegal start of expression compilation error?

java error in for loop condition evaluation: not a statement, illegal start of expression

What's wrong with my java program, "illegal start of expression error"

Netbeans is giving me "illegal start of expression" error message on my methods

Running into an illegal start of expression error while changing the value of an array

I keep getting "Battle.java:11: error: illegal start of expression" Heelp

i'm getting this error can someone help me out **illegal start of expression

Illegal start of expression for Annotations

Why is this an illegal start of expression?

Illegal start of expression (method)

Illegal Start of Expression, trying to print

Why is it saying illegal start of expression?

Why is this an illegal start of expression?and not a statement?

java: illegal start of expression when entering int[]

How would I fix "Illegal start of expression"?

public int[][] GetArray() Says Illegal start of expression