Basic HTML version of Foils prepared Sept 6 1998

Foil 3 Java Language Basics

From Java Tutorial 98-2: Java Language and Object Oriented Techniques CPS606 Fall Semester 1999 -- Sept 7 1999. by Geoffrey C. Fox, Nancy McCracken


Java syntax has many similarities to C/C++.
  • All variables must be declared
  • Syntax, comments, control structures are the same
But there are some differences
  • No malloc or free - it has automatic garbage collection
  • No pointers - designers felt pointer arithmetic not robust or safe
  • Can declare variables almost anywhere as needed.
  • No struct, union, enum, typedef from C - it has classes and objects instead.
  • Java characters are based on 16--bit wide Unicode Worldwide Character Encoding rather than the usual 8--bit wide ASCII. This allows full support of all alphabets and hence all languages
  • Primitive types for integers and floats have machine independent semantics
  • Booleans in Java have value "true" or "false" (not 0, 1, . . .)



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Mon Sep 6 1999