前言
本文是橙子出于兴趣爱好对Java官方教程的尝试翻译,几乎每日更新,感兴趣的朋友可以关注一下橙子;翻译过程中尽可能多的对一些关键词保留了英文原文,如果你想看最纯正的英文原版教材却又看不懂,可以试着来看一下橙子的翻译版啊,欢迎大家留言讨论,冲鸭!
更多相关文章点击阅读
Java官方教程目录2020最新版
语言基础
变量小结 Summary of Variables
Java语言的术语中同时使用了fields和variables。
- Instance variables (non-static fields) 对于每个类的实例都是唯一的。
- Class variables (static fields)是使用static修饰符declare的fields;无论class被实例化了多少次,class variable始终只有一个副本(copy)。
- Local variables 存储method内部的临时状态(temporary state)。
- Parameters是为方法提供额外信息的variables。
- Local variables and parameters总是被归类为variables,而不是fields。
- 在命名fields and variables的时候,必须遵循规约。
8个基本数据类型是:byte, short, int, long, float, double, boolean, and char 。The java.lang.String 类代表字符串(character strings)。编译器将为上述的fields分配一个合理的默认值,但永远不会为局部变量分配默认值。Literals是代表固定值的源码。Arrays是一个包含固定数量单一类型值的容器对象。创建数组的时候将确定其长度。创建之后,其长度不可变。
练一练
- The term “instance variable” is another name for ___.
- The term “class variable” is another name for ___.
- A local variable stores temporary state; it is declared inside a ___.
- A variable declared within the opening and closing parenthesis of a method signature is called a ____.
- What are the eight primitive data types supported by the Java programming language?
- Character strings are represented by the class ___.
- An ___ is a container object that holds a fixed number of values of a single type.
答案
年轻人不要不讲武德,进来了点个赞再走啊!