Given the code below which adds weight to an object
How can I create a method, NewTruckWeight() that will not change the state of the obj.
Instead I want it to add pounds using the state of the current obj, instantiating and returning a new truck obj, without altering the state of the current obj?
class TruckTest {
public static void main(String[] args){
Truck t1 = new Truck(5,125000);
Truck t2 = new Truck(6,17000);
//print the orginal weight of t1
System.out.println(t1.getWeight());