您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Content Index

Content Page # 48

Other kinds of expression

An expression can evaluate to any of the types Java supports — i.e.:

  • char
  • boolean
  • numeric (int, byte, short, long, float, double)
  • array
  • object

When a variable identifier appears in a program it evaluates to a value of its type (primitive, array or object). Likewise, a message sent to an object, whose corresponding method returns a value will evaluate to the type of the value of the reply (for example, the method Math.random() returns a reply value of type double).

Each time you assign a value to a variable, perform a test for a selection or iteration statement, pass arguments with messages, and write statements to process the replies from methods you will be dealing with expressions. They are an invaluable feature of the Java programming language.

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg