0% found this document useful (0 votes)
12 views5 pages

4.1 Java - Lecture20 PDF

This lesson explains the concepts of expressions and assignment statements in programming. An expression can be reduced to a single value, while an assignment statement assigns a value to a variable, making it an expression as well. The lesson concludes with a note on copyright and a prompt for the next homework assignment.

Uploaded by

oanodocometa1997
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

4.1 Java - Lecture20 PDF

This lesson explains the concepts of expressions and assignment statements in programming. An expression can be reduced to a single value, while an assignment statement assigns a value to a variable, making it an expression as well. The lesson concludes with a note on copyright and a prompt for the next homework assignment.

Uploaded by

oanodocometa1997
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Lesson 20

Assignment and
Expression Statements.

PRESENTED BY

Keith Vassallo icemalta.com


What is an Expression?
- An expression is something that can be reduced into a single value.
• 4+4 -> is an expression that can be reduced to 8.
• 16-4*7/2 -> is an expression that can be reduced to 2.
• 17 > 23 -> reduces to false.

- This also applies to variables.


• age = 28 -> reduces to 28.
• char = ‘c’ -> reduces to c.

icemalta.com
What is an Assignment?
- An assignment statement is also an expression.
- For example:
• float temp = 23.22f;
• Dog rex = new Dog();
- In both these cases, the statement can be reduced to a single value,
meaning it is an expression statement.
- We are also giving a variable a value, which is an assignment statement,
or you could call it an assignment expression.
- So, this:
• int x = 14

icemalta.com
• … is technically a declaration assignment expression!
Great work, you’ve completed this lesson!

Next up: Homework 3 - Pick the Right


Data Type.

icemalta.com
© 2011-2017 Institute of Computer Education Ltd.

The contents of this document are copyright to the Institute of Computer Education Ltd, unless otherwise stated, and must not be reproduced without permission.

Every effort has been made to trace all of the copyright holders, but if any have been inadvertently overlooked the Institute of Computer Education Ltd. will be pleased to make the necessary arrangements at the first
opportunity. Please contact us directly. While the Institute of Computer Education Ltd. has taken all reasonable care in the preparation of this work, the Institute of Computer Education Ltd. makes no representation,
express or implied, with regard to the accuracy of the information contained in this work and cannot accept any legal responsibility or liability for any errors or omissions from the work or the consequences thereof.
The reader assumes sole responsibility for the selection of these materials to achieve its intended results. Products and services that are referred to in this work may be either trademarks and/or registered
trademarks of their respective owners. The editors and author/s make no claim to these trademarks. icemalta.com

You might also like