From the course: Java 8 Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Using Java operators

Using Java operators - Java Tutorial

From the course: Java 8 Essential Training

Start my 1-month free trial

Using Java operators

- I've already used a number of Java's operators in my examples, but I'll take a moment now to go through them in detail. Java syntax is based on C. It's a C-style language. And so it uses most of the same operators that you'll find in most C-style languages, including C, C++, C#, JavaScript, and so on. There are various types of operators. The equality operators are used to compare values to each other, assignment operators do exactly what it says, assign values, and there are mathematical operators and logical operators. Here are some of the most common assignment and math operators. When you declare a variable in Java you always start with the data type followed by the name of the variable. But you don't have to immediately assign a value. The default value will depend on whether the variable is a primitive or an object. But if you want to assign a value, you use the single "=" character as the assignment operator. The data type and variable name go on the left, and the value on…

Contents