Question: rhe following programs contain errors. Find the errors, correct it, and write output. i You are not allowed to add any new codes) (No partial
rhe following programs contain errors. Find the errors, correct it, and write output. i You are not allowed to add any new codes) (No partial credit) Point 5 package javaapplication93; public class Tank { private int gallons; public Tank0 gallons-50;3 public Tank(int gal-0) gallons-gal;) public void getGallons0 return gallons;) package javaapplication93; public class ConstructorDemo{ public static void main(Stringl] args) Tank obj1-new Tank(9); Tank obj2 = new Tank(); I/ Display the objl's gallon. System.out.println("The objl's gallons is " + obj1.getGallons0); // Display the obj2% gallon. System.out.println("The obj2's gallons is"+ obj2.getGallons0); System.out.println0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
