Your netsalary() method is using the instance variables salary and tax which are initialised to 0 so when you do salary*tax it is 0*0=0
The main method is using its own copy of the salary and tax...