Someone, Please Help Debug This Code - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Someone, Please Help Debug This Code (271 Views)
1 Reply
| Someone, Please Help Debug This Code by lapo(op): 9:22pm On Mar 07, 2021 |
Hello all, please I can't pinpoint what I am getting wrong here. Someone help please. public class Myclass{ public static void main(String [] args){ Inventory.trophy = new Inventory(); trophy.getlastbalance(); //Inventory.goldberg = new Inventory(); trophy.name = "trophy"; trophy.initialbalance = 20; trophy.bought = 40; trophy.sold = 10; System.out.println("Stock of Trophy is "+ trophy.getlastbalance()); /*goldberg.initialbalance = 10; goldberg.bought = 24; goldberg.sold = 10; System.out.println("Stock of Goldberg is "+ goldberg.getlastbalance()); */ } } public class Inventory{ String name = "trophy"; int initialbalance; int bought; int sold; public int getlastbalance(){ return (initialbalance + bought - sold); //System.out.println("Stock of Trophy is "+ trophy.getlastbalance()); } } |
Someone, Please Help Debug This Code • Can Somebody Help Me Debug This? • Debug This Code At Your Spare Time. • 2 • 3 • 4
Microsoft Dynamix Consultant Needed In Lagos • I Want To Download A Good Crypto Wallet. • Advice On Web Development Project