⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java3.txt

📁 这是一些介绍JAVA的东东,主要面对要学习JAVA的朋友,28天来对JAVA有一个比较系统的了解.
💻 TXT
📖 第 1 页 / 共 5 页
字号:
appendix A

Language Summary

by Laura Lemay


                            CONTENTS
  * Reserved Words
  * Comments
  * Literals
  * Variable Declaration
  * Variable Assignment
  * Operators
  * Objects
  * Arrays
  * Loops and Conditionals
  * Class Definitions
  * Method and Constructor Definitions
  * Packages, Interfaces, and Importing
  * Exceptions and Guarding


This appendix contains a summary or quick reference for the Java
language, as described in this book.

                                                                 
  Technical Note                                                 
                                                                 
  This is not a grammar overview, nor is it a technical          
  overview of the language itself. It's a quick reference to     
  be used after you already know the basics of how the           
  language works. If you need a technical description of the     
  language, your best bet is to visit the Java Web site          
  (http://java.sun.com) and download the actual specification,   
  which includes a full BNF grammar.                             
                                                                 
Language keywords and symbols are shown in a monospace font.
Arguments and other parts to be substituted are in italic
monospace.

Optional parts are indicated by brackets (except in the array
syntax section). If there are several options that are mutually
exclusive, they are shown separated by pipes ([|]) like this:

[ public | private | protected ] type varname

Reserved Words

The following words are reserved for use by the Java language
itself (some of them are reserved but not currently used). You
cannot use these words to refer to classes, methods, or variable
names:

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

/* this is a multiline comment */
// this is a single-line comment
/** Javadoc comment */

Literals

                                                          
        number              Type int                      
                                                          
        number[l | L]       Type long                     
                                                          
        0xhex               Hex integer                   
                                                          
        0Xhex               Hex integer                   
                                                          
        0octal              Octal integer                 
                                                          
        [ number ].number   Type double                   
                                                          
        number[ f | f]      Type float                    
                                                          
        number[ d | D]      Type double                   
                                                          
        [ + | - ] number    Signed                        
                                                          
        numberenumber       Exponent                      
                                                          
        numberEnumber       Exponent                      
                                                          
        'character'         Single character              
                                                          
        "characters"        String                        
                                                          
        ""                  Empty string                  
                                                          
        \b                  Backspace                     
                                                          
        \t                  Tab                           
                                                          
        \n                  Line feed                     
                                                          
        \f                  Form feed                     
                                                          
        \r                  Carriage return               
                                                          
        \"                  Double quote                  
                                                          
        \'                  Single quote                  
                                                          
        \\                  Backslash                     
                                                          
        \uNNNN              Unicode escape (NNNN is hex)  
                                                          
        true                Boolean                       
                                                          
        false               Boolean                       
                                                          
Variable Declaration

                                                                 
  [ byte | short | int | long ]        Integers (pick one type)  
  varname                                                        
                                                                 
  [ float | double ] varname           Floats (pick one type)    
                                                                 
  char varname                         Characters                
                                                                 
  boolean varname                      Boolean                   
                                                                 
  classname varname                    Class types               
                                                                 
  interfacename varname                Interface types           
                                                                 
  type varname, varname, varname       Multiple variables        
                                                                 
The following options are available only for class and instance
variables. Any of these options can be used with a variable
declaration:

                                                                 
  [ static ] variableDeclaration     Class variable              
                                                                 
  [ final ] variableDeclaration      Constants                   
                                                                 
  [ public | private | protected     Access control              
  ] variableDeclaration                                          
                                                                 
  [volatile] varname                 Modified asynchronously     
                                                                 
  [transient] varname                Not persistent (not yet     
                                     implemented)                
                                                                 
Variable Assignment

                                                              
      variable = value      Assignment                        
                                                              
      variable++            Postfix increment                 
                                                              
      ++variable            Prefix increment                  
                                                              
      variable--            Postfix decrement                 
                                                              
      --variable            Prefix decrement                  
                                                              
      variable += value     Add and assign                    
                                                              
      variable -= value     Subtract and assign               
                                                              
      variable *= value     Multiply and assign               
                                                              
      variable /= value     Divide and assign                 
                                                              
      variable %= value     Modulus and assign                
                                                              
      variable &= value     AND and assign                    
                                                              
      variable |= value     OR and assign                     
                                                              
      variable ^= value     XOR and assign                    
                                                              
      variable <<= value    Left-shift and assign             
                                                              
      variable >>= value    Right-shift and assign            
                                                              
      variable >>>= value   Zero-fill right-shift and assign  
                                                              
Operators

                                                            
        arg + arg                 Addition                  
                                                            
        arg - arg                 Subtraction               
                                                            
        arg * arg                 Multiplication            
                                                            
        arg / arg                 Division                  
                                                            
        arg % arg                 Modulus                   
                                                            
        arg < arg                 Less than                 
                                                            
        arg > arg                 Greater than              
                                                            
        arg <= arg                Less than or equal to     
                                                            
        arg >= arg                Greater than or equal to  
                                                            
        arg == arg                Equal                     
                                                            
        arg != arg                Not equal                 
                                                            
        arg && arg                Logical AND               
                                                            
        arg || arg                Logical OR                
                                                            
        ! arg                     Logical NOT               
                                                            
        arg & arg                 AND                       
                                                            
        arg | arg                 OR                        
                                                            
        arg ^ arg                 XOR                       
                                                            

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -