在demo方法在一次迭代后输入为'y'后调用后,它应该再次请求继续吗? (y/n)请帮助!! Thnxx提前调用函数或返回主方法
public void demo()
{
System.out.println("Withdrawal or deposit? (w/d) :");
char choice = s.next().charAt(0);
System.out.println("Checking or Savings? (c/s) :");
char choicetwo = s.next().charAt(0);
System.out.println("Amount? : ");
int amt = s.nextInt();
}
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
Child c = new Child();
c.display();
c.demo();
System.out.println("Continue? : ");
char input = s.next().charAt(0);
while(input == 'y')
{
c.demo();
}
尽管这段代码可以解决这个问题,[包括解释](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)真的有帮助以提高您的帖子的质量。请记住,您将来会为读者回答问题,而这些人可能不知道您的代码建议的原因。 – DimaSan