Search processing.org:

Index \ Java \ ActionScript \ Lingo \ Python \ Design By Numbers
The Processing environment is written in Java. Programs writen in Processing are also translated to Java and then run as Java programs. Programs written in Java and Processing will usually run faster than programs based on scripting languages like ActionScript and Lingo, which is important for many graphics applications.
Large distinctions between Processing and Java are the Processing graphics library and a simplified programming style that doesn't require users to understand more advanced concepts like classes, objects, or animation and double-buffering (while still making them accessible for advanced users). Such technical details must be specifically programmed in Java, but are integrated into Processing, making programs shorter and easier to read.
In the comparison below, Java 1.1 syntax is used for the drawing functions and events because it is most compatible with displaying Java Applets on the web.

Processing | Java
background(0); background(255); | g.setColor(Color.black) fillRect(0, 0, size.width, size.height); g.setColor(Color.white) fillRect(0, 0, size.width, size.height);
background(255, 204, 0); | g.setColor(new Color(255, 204, 0)); fillRect(0, 0, size.width, size.height);
stroke(255); stroke(0); | g.setColor(Color.white) g.setColor(Color.black)
stroke(255, 204, 0); | g.setColor(new Color(255, 204, 0));
fill(0, 102, 153); | g.setColor(new Color(0, 102, 153));

Processing | Java
point(30, 20); | g.drawLine(30, 20, 30, 20);
line(0, 20, 80, 20); | g.drawLine(30, 20, 80, 20);
rect(10, 20, 30, 30); | g.fillRect(10, 20, 30, 30); g.drawRect(10, 20, 30, 30);

Processing | Java
int x = 70; // Initialize x = 30; // Change value | int x = 70; // Initialize x = 30; // Change value
float x = 70.0; x = 30.0; | float x = 70.0f; x = 30.0f;
int[] a = {5, 10, 11}; a[0] = 12; // Reassign | int[] a = {5, 10, 11}; a[0] = 12; // Reassign

Processing | Java
void draw() { // Statements } | while(true) { // Statements }
for(int a=45; a<=55; a++) { // Statements } | for(int a=45; a<=55; a++) { // Statements }
if(c==1) { // Statements } | if(c==1) { // Statements }
if(c!=1) { // Statements } | if(c!=1) { // Statements }
if(c < 1) { // Statements } | if(c < 1) { // Statements }
if(c >= 1) { // Statements } | if(c >= 1) { // Statements }
if((c >= 1) && (c < 20)) { // Statements } | if((c >= 1) && (c < 20)) { // Statements }
if(c >= 20) { // Statements 1 } else if (c == 0) { // Statements 2 } else { // Statements 3 } | if(c >= 20) { // Statements 1 } else if (c == 0) { // Statements 2 } else { // Statements 3 }

Processing | Java
// Comment | // Comment
void doIt(int x) { // Statements } doIt(x); | public void doIt(int x) { // Statements } doIt(x);
int square(int x) { return x*x; } square(X); | public int square(int x) { return x*x; } square(X);

Processing | Java
mouseX mouseY | /* Assuming there are two variables in the program named MouseX and MouseY, these values must be changed by the programmer in the mouseMoved() and mouseDragged methods. */ public void mouseMoved(MouseEvent e) { mouseX = e.getX(); mouseY = e.getY(); } public void mouseDragged(MouseEvent e) { mouseX = e.getX(); mouseY = e.getY(); }
void mousePressed() { // Statements } | public void mousePressed(MouseEvent e) { // Statements }
if (key=='a') { // Statements } | public void keyPressed(KeyEvent e) { char key = e.getKeyChar(); if(key == 'a') { // Statements } }
void keyPressed() { // Statements } | public void keyPressed(KeyEvent e) { // Statements }

Processing >> Java 1.1 by REAS, fry