J
jtl.zheng
codes
---------------------------
method1:
public static int getArrayLength(String[] s){
return s.length;
}
method2:
public static int getArrayLength(char[] s){
return s.length;
}
--------------------------
as you see, they contain the same body codes
so I want to make this two methods into one menthod
then when I want to modify ,I don't need to write twice in two method
or is there any syntx in Java acted like the C++'s inline function?
thank you very much in advance
: )
---------------------------
method1:
public static int getArrayLength(String[] s){
return s.length;
}
method2:
public static int getArrayLength(char[] s){
return s.length;
}
--------------------------
as you see, they contain the same body codes
so I want to make this two methods into one menthod
then when I want to modify ,I don't need to write twice in two method
or is there any syntx in Java acted like the C++'s inline function?
thank you very much in advance
: )