• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 36. Developing Java Applets > Basic Language Constructs

Basic Language Constructs

This section introduces Java language basics that will aid you in the creation of applets. Tables 36.1 through 36.4 summarize Java's basic language constructs. Table 36.1 shows the data types available for variables and constants. Table 36.2 shows the operators available for manipulating those variables and constants. Table 36.3 shows the major statements of the language, used for controlling the flow of execution through the program. The last table, Table 36.4, shows three ways to add comments to your program.

Table 36.1. Basic Language Constructs (Java Types)
Type Example Notes
boolean boolean flag = false; A Java boolean is just true or false. It cannot be cast to char or int.
char char c[] = { 'A','\ uu42','C'} ; A Java char is a 16-bit Unicode character. Use the Java String class to manage Unicode strings.
byte byte b = 0x7f; 8-bit signed integer (–127 .. 127).
short short s = 32767; 16-bit signed integer (–32,768 .. 32,767).
int int i = 2; 32-bit signed integer.
long long l = 2L; 64-bit signed integer. Use the suffix L for a long (decimal) literal.
float float x = 2.0F; 32-bit IEEE754 number. Use the suffix F for a float literal.
double double d = 2.0; 64-bit IEEE754 number (15 significant digits).



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint