1. Home
  2. Computing & Technology
  3. Java

Expression Statement

By , About.com Guide

Definition:

Expression statements are expressions that can be used as statements by simply adding a semicolon. When they are executed the value of the expression is evaluated.

The expressions that can be made into statements:

  • use the increment (++) and decrement (--) unary operators.
  • assign values to variables.
  • call object methods.
  • create objects.
Examples:
//assigning a value
number = 42;

//using the increment operator
number++;

//using the decrement operator
--number;

//calling a method
System.out.println("Is " + number + " the answer to the Ultimate Question of Life, the Universe and Everything?");

//creating an object
Universe realityOne = new Universe(42);

Glossary:

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Explore Java
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Java Glossary
  5. E
  6. Expression Statement - Definition for the Java Term: Expression Statement>

©2010 About.com, a part of The New York Times Company.

All rights reserved.