up previous next contents
Next: Arrays Up: Variables, constants, and keywords Previous: Constants   Contents

Reserved keywords

  • Reserved Java keywords:

abstract default if private throw
boolean do implements protected throws
break double import public transient
byte else instanceof return try
case extends int short void
catch final interface static volatile
char finally long super while
class float native switch  
const for new synchronized  
continue goto package this  

Fibonnaci program

  • Here is a Fibonnaci program from The Java Programming Language:
    class Fibonacci {
       public static void main (String args[])
       {
          int lo = 1;
          int hi = 1;
          System.out.println(lo);
          while ( hi < 50 )
          {
             System.out.println(hi);
             hi = lo + hi;
             lo = hi - lo;
          }
      }
    }
    
  • Type this code into the proper filename.
  • Compile and run the program.
  • Discuss the results.


up previous next contents
Next: Arrays Up: Variables, constants, and keywords Previous: Constants   Contents