• Post Reply Bookmark Topic Watch Topic
  • New Topic

illegal start of expression?  RSS feed

 
nikhil saini
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added code tags to your question. As you can see, the forum software can properly format your code if you use those.

Please explain where in your program the error occurs.

My guess: you forgot a closing } between lines 32 and 33 and the } in line 96 should be removed.
 
nikhil saini
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir I am getting an error in this line


public static void printEmployee(Employee emp) {

the error is illegal start of expression??
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nikhil saini wrote: sir I am getting an error in this line

public static void printEmployee(Employee emp) {

the error is illegal start of expression??


Please read Jesper's response again. The error happens just before that line.


And yes, it is illegal in Java to define a method, while you are still in another method.

Henry
 
nikhil saini
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public static void printEmployee(Employee emp) {


This line showing the error that illegal star of expression???

please help sir

how could I remove this error and make my program run.???
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nikhil saini wrote:This line showing the error that illegal star of expression???

please help sir

And as already mentioned twice, that line is illegal in Java. Since when is it legal to define a method inside another method?

Henry
 
nikhil saini
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


my program is running but why it is not giving any output??

no output?? why so?
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is because you have not invoked any method that produces output.
Please, UseCodeTags ← click this.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!