We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,629 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

illegal start expression NetBeans

My issue is that after public static void Head() { each of the following sets is highlighted red for an illegal start expression error. I've tried moving the bracketts around removing words like static or public. (I'm 3 classes into java). I just need help in getting that issue to dissapear. the public static head, works fine and can be seen in the output. any ideas?

/*
 * Justin Towle
 * COS160
 */

/**
 *
 * 
 */
public class Robot {
    public static void main(String[] args) {
        Head();
        Neck();
        Body();
        legs();
        feet();
    }

    public static void Head() {
        System.out.println(".--------. ");
        System.out.println("| o   o  |");
        System.out.println("|   <    |");        
        System.out.println("| - - -  |");
        System.out.println("'--------' ");

    public static void Neck() {
        System.out.println("  |    |  ");
        System.out.println("  |    |  ");

    public static Body() {
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");
        System.out.println("#########");

    public static void legs() {
        System.out.println("  |  |    |  |    ");
        System.out.println("  |  |    |  |    ");
        System.out.println("  |  |    |  |    ");
        System.out.println("  |  |    |  |    ");
        System.out.println("  |  |    |  |    ");
        System.out.println("  |  |    |  |    ");

    public static void feet() {
        System.out.println("=========     =========");
    }
}
3
Contributors
2
Replies
1 Hour
Discussion Span
8 Months Ago
Last Updated
3
Views
DavidTPotterNY
Newbie Poster
1 post since Sep 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Check that all the {s have a } that pairs with it. First place to look would be where the error messages start.

NormR1
Posting Sage
Team Colleague
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16

It seems you don't have closing '}' for each opening '{' in your source. This is important since these braces define what code makes up each method.

dmanw100
Posting Whiz in Training
271 posts since Apr 2008
Reputation Points: 104
Solved Threads: 32
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0584 seconds using 2.7MB