
class MOrders { int nooforders; // Data members of the class public int getorder() { nooforders = 500; } public void displayorders() { System.out.println("The number of orders to be delivered: "+ nooforders); } public static void main(String args[]) { MOrders obj = new MOrders (); obj.getorder(); obj.displayorders(); } }
when this code is compliled it shows errors.Indentify and document the changes

In your code, return statement was missing.
Here is the code:
class MOrders {
int nooforders;
public int getorder() {
nooforders = 500;
return nooforders;
}
public void displayorders() {
System.out.println("The number of orders to be delivered: "+ nooforders);
}
public static void main(String args[]) {
MOrders obj = new MOrders ();
obj.getorder();
obj.displayorders();
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.