day04--方法_重载练习
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.inmind.method01;
|
||||
/*
|
||||
* 方法重载:两同一不同
|
||||
* 1.同一类中
|
||||
* 2.方法名相同
|
||||
* 3.参数列表不同(参数列表的个数,数据类型,参数的顺序)
|
||||
|
||||
class Demo
|
||||
{
|
||||
void show(int a,float b,char c)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
下列哪些方法和指定的方法重载了。
|
||||
a.int show(int x,float y,char z)
|
||||
|
||||
b.void show(float b,int a,char c)
|
||||
|
||||
c.void show(int c,float a,char b)
|
||||
|
||||
d.void show(int a,int b,int c)
|
||||
|
||||
e.double show()
|
||||
*/
|
||||
public class Test06 {
|
||||
|
||||
void show(int a,float b,char c)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//a
|
||||
/*int show(int x,float y,char z){
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
//b
|
||||
void show(float b,int a,char c){
|
||||
|
||||
}
|
||||
|
||||
//c
|
||||
// void show(int c,float a,char b){}
|
||||
|
||||
void show(int a,int b,int c){
|
||||
|
||||
}
|
||||
|
||||
double show(){
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user