我收到方法名称下的红线,为什么发生这种情况?方法未运行
Scanner input=new Scanner(System.in);
System.out.println("enter your account number");
int account_num= input.nextInt();
System.out.println("enter your name");
String account_owner=input.nextLine();
System.out.println("enter your account balance");
double current_balance=input.nextDouble();
System.out.println("enter 1 to deposit \nenter 2 to withdraw"
+"\nenter 3 to add interest value"
+"\nenter 4 to print all the information");
int option= input.nextInt();
if (option==1){
System.out.println("enter the amount of money to be depsit");
double Damount=input.nextDouble();
double a =Deposit(Damount,current_balance);
System.out.print(a);
public static double Deposit(double amount, double balance){
balance+=amount;
System.out.println("transction successful");
}}
哪个方法命名? –
如果你有红线,这表明你有一个编译时错误。请在你的文章中加入。阅读http://tinyurl.com/stack-hints关于为Stack Overflow写一个好问题的建议。 –
你在你的代码中有几个问题..方法'公共静态double Deposit()'需要在你的* current *方法之外。你还需要在'String account_owner = input.nextLine();' – TheLostMind