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

//call mutateWeight()

//here is the call NewTruckWeight(1000), I want to assign a new Truck reference to t2???


class Truck {
private int numaxles;
private int weight;

Truck(int axles, int w) {
numaxles = axles;
weight =w;
int getWeight() {
return weight;
int getnumaxles() {
return numaxles;

//add the mutateWeight()
int mutateWeight(int i) {
weight=(i + weight);
return weight;

//add NewTruckWeight()???{


Thanks, hope that is clear....