1 Replies - 276 Views - Last Post: 07 July 2011 - 02:10 PM Rate Topic: -----

#1 lipag  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-July 11

illegal start of expression

Posted 07 July 2011 - 01:52 PM

i m gettitng the error "illegal start of expression" with this code

can any1 help

class Dog{
public static void main(String[] args){
Dog d = new Dog ();


void bark (int numOfBarks)
{
while(numOfBarks > 0)
{
System.out.println("rDogTestDriveuff") ;
numOfBarks = numOfBarks - 1 ;
}
}
}
}
Is This A Good Question/Topic? 0
  • +

Replies To: illegal start of expression

#2 maniacalsounds  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 117
  • View blog
  • Posts: 472
  • Joined: 27-June 10

Re: illegal start of expression

Posted 07 July 2011 - 02:10 PM

The problem is that you never closed your main() method. Add a clsing curly brace to fix this. :)

It goes after the creation of the dog object :)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1