請幫忙解答下代碼中三個問號????
比如
public class HellWorld{
int a ? ? int b?
HelloWorld hello=new HelloWorld();//創(chuàng)建類得對象
hello.c(1,2);//類對象只有調(diào)用c方法之后才可以輸入實(shí)參?
c hello2=new c(1,2)//創(chuàng)建c方法對象的同時可以輸入實(shí)參?
public void (這個地方void沒寫是不是也代表沒返回值?)c (int c,int d) {?
a=c ?b=d
System.out.println(a,b);
}
2016-05-05
1、因為c方法中需要兩個參數(shù),所以用hello對象調(diào)用c方法時必須有參數(shù)
2、創(chuàng)建hello2對象時也可以輸入實(shí)參,因為c方法中需要兩個參數(shù)
3、void不能省略,構(gòu)造方法才要省略
2016-05-05
c=1,d=2;這里面的int c? int d? 只是形式參數(shù)
c括號后面的為方法? 所有帶()的都是方法
如果后面的void? 花括號里面就得有return c+d?? 而且前面還得表明返回值類型? int? (用來代替void)
2016-05-05
1、因為c方法中需要兩個參數(shù),所以用hello對象調(diào)用c方法時必須有參數(shù)
2、創(chuàng)建hello2對象時也可以輸入實(shí)參,因為c方法中需要兩個參數(shù)
3、void不能省略,它又不是構(gòu)造函數(shù)