计算机英语笔记(1)

73 阅读2分钟

开启掘金成长之旅!这是我参与「掘金日新计划 · 12 月更文挑战」的第19天,点击查看活动详情

这个是专门写有关于计算机英语的相关知识以及内容,涉及到编程的均为java语言

1.member variable

成员变量A member variable’s scope is the entire declaration of the class.

2.Reference Types

Employee2 = Employee1; it means the Emplyee2 points to the Employee1's memory block.

3.Array

homogenous 同种 int[] a; //or int a[]; int array2D[ ][ ] = new int[3][ ];

4.this
class Counter { 
private int data; 
Counter(int var){ 
data = var; 
} 
public void increment() {
int data; 
++data;    //这里的data++的data =var 的data member variable,因为没有用到this.data
}

5.static

A non-static (instance) method can access a static data. But a static method cannot access a non-static (instance) data.

class Counter3 { 
private static int data; 
Counter3(int var){ 
data = var;    
}

public void increment() { 
++data;     //静态数据进入时没问题的,不会出现编译错误,但是反着就会
}
6.OOP
  • Abstraction 抽象
  • Encapsulation 封装
  • Inheritance 继承
  • Polymorphism 多态
7.class

image.png

8.称呼
  • The methods are called behaviors and the variables are called attributes or properties.
  • The “value” of the attribute is called the state.
9.print和println区别

print()输出完毕后不换行,而println()输出完毕后会换行,因此println()不输出任何东西时,就输出一个换行符。

10.Inheritance
  • The new derived class is called the subclass.
  • The parent class is called superclass
11.override和overlord

Override(重写):发生在Java的继承中,当子类需要使用和父类方法名相同,但实现过程不同的方法时,就会用到重写。需要注意的是重写的方法的参数列表必须与父类的被重写的方法的参数列表完全一致,但返回值类型可以是父类被重写方法返回值类型的衍生类或是相同类。

Overload(重载):重载发生在同一个类中,同一个类中需要用相同的方法名但实现过程不同的时候用到重载。重载是相同方法名但参数列表不同,即可实现重载。常用的例如类的构造方法的重载。

这两个容易混淆,注意