An operator is a symbol that operates on one or more arguments to produce a result. The Hello World program is so simple it doesn't use any operators, but almost all other programs you write will.

Operator | Purpose |
---|---|

`+` |
addition of numbers, concatenation of Strings |

`+=` |
add and assign numbers, concatenate and assign Strings |

`-` |
subtraction |

`-=` |
subtract and assign |

`*` |
multiplication |

`*=` |
multiply and assign |

`/` |
division |

`/=` |
divide and assign |

`%` |
take remainder |

`%=` |
take remainder and assign |

`++` |
increment by one |

`--` |
decrement by one |

`>` |
greater than |

`>=` |
greater than or equal to |

`<` |
less than |

`<=` |
less than or equal to |

`!` |
boolean NOT |

`!=` |
not equal to |

`&&` |
boolean AND |

`||` |
boolean OR |

`==` |
boolean equals |

`=` |
assignment |

`~` |
bitwise NOT |

`?:` |
conditional |

`instanceof` |
type checking |

`|` |
bitwise OR |

`|=` |
bitwise OR and assign |

`^` |
bitwise XOR |

`^=` |
bitwise XOR and assign |

`&` |
bitwise AND |

`&=` |
bitwise AND and assign |

`>>` |
shift bits right with sign extension |

`>>=` |
shift bits right with sign extension and assign |

`<<` |
shift bits left |

`<<=` |
shift bits left and assign |

`>>>` |
unsigned bit shift right |

`>>>=` |
unsigned bit shift right and assign |

Copyright
1997, 2001, 2005 Elliotte Rusty Harold

elharo@metalab.unc.edu

Last Modified February 2, 2005

elharo@metalab.unc.edu

Last Modified February 2, 2005