auto commit

This commit is contained in:
CyC2018 2018-09-23 13:00:24 +08:00
parent 5640334d7b
commit a3b6732868

View File

@ -288,6 +288,7 @@ Java 的参数是以值传递的形式传入方法中,而不是引用传递。
```java ```java
public class Dog { public class Dog {
String name; String name;
Dog(String name) { Dog(String name) {
@ -347,7 +348,9 @@ class PassByValueExample {
## float 与 double ## float 与 double
1.1 字面量属于 double 类型,不能直接将 1.1 直接赋值给 float 变量因为这是向下转型。Java 不能隐式执行向下转型,因为这会使得精度降低。 Java 不能隐式执行向下转型,因为这会使得精度降低。
1.1 字面量属于 double 类型,不能直接将 1.1 直接赋值给 float 变量,因为这是向下转型。
```java ```java
// float f = 1.1; // float f = 1.1;
@ -588,10 +591,11 @@ System.out.println(InterfaceExample.x);
## super ## super
- 访问父类的构造函数:可以使用 super() 函数访问父类的构造函数,从而委托父类完成一些初始化的工作。 - 访问父类的构造函数:可以使用 super() 函数访问父类的构造函数,从而委托父类完成一些初始化的工作。
- 访问父类的成员:如果子类重写了父类的某个方法的实现,可以通过使用 super 关键字来引用父类的方法实现。 - 访问父类的成员:如果子类重写了父类的某个方法,可以通过使用 super 关键字来引用父类的方法实现。
```java ```java
public class SuperExample { public class SuperExample {
protected int x; protected int x;
protected int y; protected int y;
@ -608,6 +612,7 @@ public class SuperExample {
```java ```java
public class SuperExtendExample extends SuperExample { public class SuperExtendExample extends SuperExample {
private int z; private int z;
public SuperExtendExample(int x, int y, int z) { public SuperExtendExample(int x, int y, int z) {
@ -659,7 +664,6 @@ SuperExtendExample.func()
## 概览 ## 概览
```java ```java
public final native Class<?> getClass()
public native int hashCode() public native int hashCode()
@ -669,6 +673,10 @@ protected native Object clone() throws CloneNotSupportedException
public String toString() public String toString()
public final native Class<?> getClass()
protected void finalize() throws Throwable {}
public final native void notify() public final native void notify()
public final native void notifyAll() public final native void notifyAll()
@ -678,8 +686,6 @@ public final native void wait(long timeout) throws InterruptedException
public final void wait(long timeout, int nanos) throws InterruptedException public final void wait(long timeout, int nanos) throws InterruptedException
public final void wait() throws InterruptedException public final void wait() throws InterruptedException
protected void finalize() throws Throwable {}
``` ```
## equals() ## equals()
@ -806,6 +812,7 @@ public int hashCode() {
```java ```java
public class ToStringExample { public class ToStringExample {
private int number; private int number;
public ToStringExample(int number) { public ToStringExample(int number) {
@ -849,7 +856,7 @@ public class CloneExample {
private int b; private int b;
@Override @Override
protected CloneExample clone() throws CloneNotSupportedException { public CloneExample clone() throws CloneNotSupportedException {
return (CloneExample)super.clone(); return (CloneExample)super.clone();
} }
} }
@ -878,7 +885,7 @@ public class CloneExample implements Cloneable {
private int b; private int b;
@Override @Override
protected Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
return super.clone(); return super.clone();
} }
} }
@ -1052,6 +1059,7 @@ private 方法隐式地被指定为 final如果在子类中定义的方法和
```java ```java
public class A { public class A {
private int x; // 实例变量 private int x; // 实例变量
private static int y; // 静态变量 private static int y; // 静态变量
@ -1080,6 +1088,7 @@ public abstract class A {
```java ```java
public class A { public class A {
private static int x; private static int x;
private int y; private int y;
@ -1118,6 +1127,7 @@ public class A {
```java ```java
public class OuterClass { public class OuterClass {
class InnerClass { class InnerClass {
} }