Welcome to Dream.In.Code
Become a Java Expert!

Join 149,603 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,902 people online right now. Registration is fast and FREE... Join Now!




An "Illigal start of type" error... Possibly more

 
Reply to this topicStart new topic

An "Illigal start of type" error... Possibly more, *have searched and looked around for answer*

MdL
17 Sep, 2007 - 05:47 PM
Post #1

New D.I.C Head
*

Joined: 17 Sep, 2007
Posts: 1


My Contributions
I think I'm going to laugh at this once I figure it out... Anyways, I get a few issues when I try to compile this program.

CODE

public class Assignment1
{
  public static void main(String [] args);
  int step = 6;
  for (i=1; i < step; i++)
  {
    if (i == 0 || i == 1)
    {
      System.out.println("\t\t[][][]\n");
    }
    else if (i == 2 || i == 3)
    {
      System.out.println("\t[][][][]\n");
    }
    else
    {
      System.out.println("[][][][]\n");
    }
  }
}


It has a problem here
CODE


  for (i=1; i < step; i++)


Complains about an illegal start of type. This may not only be the only issue. Basically I'm trying to get the following output.

IPB Image
Its supposed to be a climbing staircase.

I appreciate any help here... I think I basically need to declare "i" right? But I have an issue doing that... I have done my end and I have been researching on how to get this running but I'm stuck and I've been working on this for over three hours... ohmy.gif
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: An "Illigal Start Of Type" Error... Possibly More
17 Sep, 2007 - 06:04 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,101



Thanked: 25 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
public static void main(String [] args);
remove the ; on this line
and add the correct set of {} for the main method.
User is offlineProfile CardPM
+Quote Post

alpha02
RE: An "Illigal Start Of Type" Error... Possibly More
18 Sep, 2007 - 03:23 AM
Post #3

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
Hi and welcome tto DIC! I suggest you get a syntax tutorial, you may find it useful!
User is offlineProfile CardPM
+Quote Post

oubless
RE: An "Illigal Start Of Type" Error... Possibly More
18 Sep, 2007 - 04:26 AM
Post #4

New D.I.C Head
*

Joined: 28 May, 2007
Posts: 23


My Contributions
Your variable called i is undefined
and as said before:
CODE
public static void main( String[] args )
{
          /* the rest of the code here, indented of course */
}


This post has been edited by oubless: 18 Sep, 2007 - 04:27 AM
User is offlineProfile CardPM
+Quote Post

UltraFlynn
RE: An "Illigal Start Of Type" Error... Possibly More
18 Sep, 2007 - 05:55 AM
Post #5

D.I.C Head
Group Icon

Joined: 3 Aug, 2007
Posts: 127


My Contributions
So if the variable is undefined, define it:

CODE
for (int i=1; i < step; i++)

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 11:52PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month