这是迄今为止的代码片段,我尝试调用在同一个类中编码的getCard方法,但它似乎在编译时会给出错误如何在同一类中的方法中调用另一个方法
@WebService
public class Card {
@WebMethod
public int getCard() {
Random r = new Random();
int rand = r.nextInt((10) + 1);
return rand;
}
public int getCards() {
int one;
one.getCard();
int two;
two.getCard();
//getCard one = new getCard();
//getCard two = new getCard();
int three = (one + two);
return three;
}
}
'one.getCard();'?其中一个是原始的int? –
getCard()是为Card对象而不是int定义的。 – TheLostMind