₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,083 members, 8,420,235 topics. Date: Thursday, 04 June 2026 at 02:12 PM

Toggle theme

Someone, Please Help Debug This Code - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingSomeone, 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());
}


}
1 Reply

Someone, Please Help Debug This CodeCan Somebody Help Me Debug This?Debug This Code At Your Spare Time.234

Microsoft Dynamix Consultant Needed In LagosI Want To Download A Good Crypto Wallet.Advice On Web Development Project