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

Chapter 37. 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 37.1, 37.2, 37.3, 37.4 summarize Java's basic language constructs. Table 37.1 shows the data types available for variables and constants. Table 37.2 shows the operators available for manipulating those variables and constants. Table 37.3 shows the major statements of the language, used for controlling the flow of execution through the program. The last table, Table 37.4, shows three ways to add comments to your program.

Table 37.1. Basic Language Constructs (Java Types)
TypeExampleNotes
booleanboolean flag = false;A Java boolean is just true or false.
  It cannot be cast to char or int.
charchar c[] = {'A','\uu42','C'};A Java char is a 16-bit Unicode character.
  Use the Java String class to manage Unicode strings.
bytebyte b = 0x7f;8-bit signed integer (-127 .. 127).
shortshort s = 32767;16-bit signed integer (-32,768 .. 32,767).
intint i = 2;32-bit signed integer.
longlong l = 2L;64-bit signed integer. Use the suffix L for a long (decimal) literal.
floatfloat x = 2.0F;32-bit IEEE754 number. Use the suffix F for a float literal.
doubledouble 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