Syntax error on token "class", Identifier expected

eggrolls :

I have 2 tabs on my Processing program. I actually copied and pasted the exact code from a YouTube tutorial and keep getting the error message when I run.

Tab 1:

class Bubble {    

float x;
float y;

Bubble (){
  x=width/2;
  y=height; 
}

void ascend (){
  y--;
}

void display() {
  stroke(0);
  fill(127); 
  ellipse(x,y,64,64); 
  }      
}

Tab2:


Bubble b; 

void setup() {
  size(640,360); 
  b=new Bubble();
}

void draw () {
  background(255); 
  b.ascend();
  b.display();
  //b.top();
}

The error message says that:

Syntax error on token "class", Identifier expected
Kevin Workman :

Processing functions like setup() and draw() need to be in the first tab.

I'm not totally sure why this is. It shouldn't be strictly necessary because all of the tabs get converted into one Java file, unless your tab names ends with .java. My guess is this is a quirk of the Processing -> Java compiler.

You could file a bug on the Processing GitHub repo, but I think your best bet is to make sure all your Processing functions are in the first tab.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Syntax error on token "void", @ expected

Syntax error on token "class"

Identifier expected after this token Error

using of UI element in my script is giving "Expected class name but found identifier." Syntax error

React — Syntax error: Unexpected token, expected ;

error C2760: syntax error: unexpected token 'identifier', expected ';' at map iterator

Syntax error on token "1", Identifier expected in Enum Java

how to fix expected identifier before ';' token error

syntax error on token variabledeclaratorid expected after this token

- Syntax error on token ".8", . expected

Syntax error on token ";", ,expected

Syntax error on token "boolean", @ expected

java Syntax error on token "(", ; expected

error: expected identifier or ‘(’ before ‘}’ token

error: expected identifier or ‘(’ before ‘.’ token

Textillate Plugin Syntax error on token "in", IntegerLiteral expected

syntax error: operand expected (error token is " ")

Expected identifier or ‘(’ before ‘char’ syntax error

Syntax error on token "close", Identifier expected after this token

syntax error: operand expected (error token is "+")

syntax error: operand expected (error token is "/ ")

C - "Error: Expected identifier or '(' before '[' token"

Syntax error: Unexpected token, expected ,

Java Error: <Identifier> expected Public Class

some errors like Syntax error on token ";", @ expected

syntax error: operand expected (error token is "<")

Syntax Error: Unexpected token, expected " , "

Fatal: Syntax error, "EXCEPT" expected but "identifier ON" found

C++ struct in a class with error: expected an identifier