Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot Figure Out This Syntax Error

 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got syntax error on something very simple (please refer to the code below). It is very embarrassing! I do not understand the error messages:

1. syntax error on token(s), misplaced constructs; and
2. syntax error on token "path", VariableDeclaratorId Expected after this token


and
 
Campbell Ritchie
Sheriff
Pie
Posts: 50211
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why haven't you got that line inside a method?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That line isn't declaring a variable which isn't allowed on that location. You must place that statement in a method. The constructor for instance.
 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in trouble.

In the ConsumerOrchestratorComponent class (where the syntax error happens), the tasks of that class are to

1. instantiate other components (lots of other components);
2. invoke methods on those instances. Other components have methods to carry out some work. The ConsumerOrchestratorComponent does not have method. Its work is to instantiate and invoke method on those instances.
3. Some methods in other components do not return anything.

Now, in the case that a method in another component does not return anything and the ConsumerOrchestratorComponent must instantiate that component and invoke the method on the instance, I have syntax error. What should I do?
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us a code snippet and the exact error message you're getting.
 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the ConsumerOrchestratorComponent class (where the syntax error happens), the tasks of that class are to

1. instantiate other components (lots of other components);
2. invoke methods on those instances. Other components have methods to carry out some work. The ConsumerOrchestratorComponent does not have method. Its work is to instantiate and invoke method on those instances.
3. Some methods in other components do not return anything.

Now, in the case that a method in another component does not return anything and the ConsumerOrchestratorComponent must instantiate that component and invoke the method on the instance, I have syntax error. What should I do?

code snippet:
 
Ted Smyth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie Kopple wrote:
code snippet:


That's not a valid class definition (you cannot place statements like "someObject.someMethod(params);" in a class body, they must be in a method or static initializer). This would be an example of a valid ConsumerOrchestratorComponent which does some "orchestration" via a static method:


You can then invoke it like this:
 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found out what to do. Thanks to all for your feedbacks. I appreciate them.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50211
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic