Java_Algebra

Java_Algebra - How to Perform Simple Algebra in Java Topics...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Page 1-9 How to Perform Simple Algebra in Java Topics 1. Arithmetic Operators 2. Unary and Binary Assignment Operators 3. Compiling Sourcecode and Running Bytecode 1. Assignment and Arithmetic Operators i. Usual Assignment Operator Let's first review the usual assignment operator " = " int a = 3; a = a+5; The old value of 3, is replaced by 8. It is an integer type variable. ii. Special Assignment Operators: " += " These special assignment operators are mostly just convenient shorthands. They are used so frequently by master programmers that you need to learn them to be able to understand, edit or improve existing programs. Q: What are the resulting values for a, b and c? int a, b, c; a = 3; b = 4; c = 5; a += 5; b += c;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 3-9 iii. Other Binary Assignment Operators += -= *= /= %= In all cases the variabsles on the left and right are combined and the result is stored in the left variable – replacing the previous value. Recall % denotes the remainder operator. For example: 7%4 returns 3.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Java_Algebra - How to Perform Simple Algebra in Java Topics...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online