- 雙語版Java程序設計
- 何月順主編
- 515字
- 2018-12-27 20:14:10
2.5 Lexical Elements
Java is a programming language and like any other language there are certain rules about how“words” in the language are formed and what constitutes a legal “sentence” in the language. In addition, Java has rules about how the sentences can be put together into a complete program, somewhat like the less formal rules about how to format a formal letter (e.g. with the address of the recipient, and opening salutation etc.) or how to structure a book (e.g. with chapters, a table of contents etc.). In this section we will begin by looking at the various “words” and symbols, called lexical elements, that are used to construct Java programs.
Java和其他程序語言一樣,有一些特定的語句規則,這些規則約束了哪些單詞可以使用,以及如何構成程序語言,這有點類似于寫一封規范的信(例如,收信人的稱呼、開場白等),或者是如何構建一本書(例如,篇章、目錄等)。
The most fundamental element in the structure of a program is a single character that can be displayed on a computer screen or typed at a computer keyboard. Prior to Java, most programming languages in common use during the last 10-20 years have used what is known as the ASCII character set. This character set provides for 256 different characters. This may seem like a lot, but when you consider all of the human languages in the world and the various symbols they use, it turns out that 256 is not enough. Therefore, Java has adopted what is called the Unicode character set. This set provides for more than 64,000 different characters.
When a Java compiler first begins to analyze a Java program it groups the individual characters together into larger lexical elements usually called tokens(符號). Some of the tokens will only be one character long such as the plus sign “+” which is the Java symbol used to add two numbers together(among other things). Other tokens will be many characters long such as the keywords like class and public. These basic tokens are then combined into larger language structures such as expressions, method calls, class definitions etc.
當Java編譯器開始分析Java程序時,它將各個字符集合在一起成為更大的元素,通常稱為符號。有些符號只有一個字符長,例如“+”在Java語言中將兩個數字加在一起。其他符號可以為多個字符,如關鍵詞class和public。
- Hands-On Intelligent Agents with OpenAI Gym
- 現代測控電子技術
- Dreamweaver CS3網頁制作融會貫通
- Apache Hive Essentials
- Mastering Machine Learning Algorithms
- 大數據安全與隱私保護
- AWS Certified SysOps Administrator:Associate Guide
- Docker High Performance(Second Edition)
- 聊天機器人:入門、進階與實戰
- 多媒體制作與應用
- 計算機組網技術
- 從零開始學SQL Server
- 機器人人工智能
- 單片機原理實用教程
- INSTANT VMware vCloud Starter