Method parameter mismatch: Required double, no argument passed

为君一笑 提交于 2019-12-02 13:26:39
userTax = test.getUserTax();

You need to pass double value as parameter to this call. Your getUserTax method defined as double type parameter required.

public static double getUserTax(double income)

Example:

userTax = test.getUserTax(10.0); //Here 10.0 is just for example.

Just change this method signature: -

public static double getUserTax(double income)

to: -

public static double getUserTax()

You don't need to pass any income parameter, as that you are already having income as instance attribute in IncomeTax class. And when you invoke this method on an IncomeTax instance: -

test.getUserTax();

the income used in the method is nothing but this.income, which references the instance attribute.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!