auto commit
This commit is contained in:
parent
f80486b832
commit
e630613380
@ -1323,55 +1323,6 @@ public static void main(String[] args) {
|
||||
应该注意的是,返回值不同,其它都相同不算是重载。
|
||||
|
||||
|
||||
- 方法重载 例子
|
||||
```java
|
||||
class DisplayOverloading
|
||||
{
|
||||
public void disp(char c)
|
||||
{
|
||||
System.out.println(c);
|
||||
}
|
||||
public void disp(char c, int num)
|
||||
{
|
||||
System.out.println(c + " "+num);
|
||||
}
|
||||
}
|
||||
class Sample
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
DisplayOverloading obj = new DisplayOverloading();
|
||||
obj.disp('a');
|
||||
obj.disp('a',10);
|
||||
}
|
||||
}
|
||||
```
|
||||
[Method Overloading](https://beginnersbook.com/2013/05/method-overloading/)
|
||||
|
||||
- 构造重载 例子
|
||||
```java
|
||||
class DisplayOverloading
|
||||
{
|
||||
DisplayOverloading(char c)
|
||||
{
|
||||
System.out.println(c);
|
||||
}
|
||||
DisplayOverloading(char c, int num)
|
||||
{
|
||||
System.out.println(c + " "+num);
|
||||
}
|
||||
}
|
||||
class Sample
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
DisplayOverloading obj = new DisplayOverloading('a');
|
||||
DisplayOverloading obj2 = new DisplayOverloading('a',10);
|
||||
}
|
||||
}
|
||||
```
|
||||
[Constructor Overloading](https://beginnersbook.com/2013/05/constructor-overloading/)
|
||||
|
||||
# 七、反射
|
||||
|
||||
每个类都有一个 **Class** 对象,包含了与类有关的信息。当编译一个新类时,会产生一个同名的 .class 文件,该文件内容保存着 Class 对象。
|
||||
|
@ -49,7 +49,6 @@
|
||||
- [9. 用两个栈实现队列](9.%20用两个栈实现队列.md)
|
||||
- [30. 包含 min 函数的栈](30.%20包含%20min%20函数的栈.md)
|
||||
- [31. 栈的压入、弹出序列](31.%20栈的压入、弹出序列.md)
|
||||
|
||||
- [40. 最小的 K 个数](40.%20最小的%20K%20个数.md)
|
||||
- [41.1 数据流中的中位数](41.1%20数据流中的中位数.md)
|
||||
- [41.2 字符流中第一个不重复的字符](41.2%20字符流中第一个不重复的字符.md)
|
||||
|
Loading…
Reference in New Issue
Block a user