Variables

From Progzoo
Jump to: navigation, search

A variable holds a value. When we write the program we may not know the actual value of the variable. The value is only known at execution time.

In this example we have a variable called x.

  • It is declared and initialised by the line
int x=42;
  • It is used in first the println statement.
  • The second println statement shows double x - but x does not change.
  • The increment x statement is
x++;


[Font] [Default] [Show] [Resize] [History] [Profile]