You're confusing the object notion with the static method concept:
you can have many instances of objects like Test (test2, test2, etc...) each instance will have its own life: in real life the analogy is having many cars (instances) of the class (toyota corolla) for example: all cars are made as described by the model sepecification (the class)
Then you have static methods which are methods that do not use a concrete instance: for example: security ckecks can be a static method: many cars come through a unique security check (that is not a function you can launch from within your car: it's not depending on the instance)
You can use this sample to understand better
public class Test{
int trails;
int days;
public String toString() {
return "trails :"+ trails +", days : "+ days;
}
}
public class Launcher{
public static void main (String []args){
if(args.length!=0){
Test test = new Test();
test.trails= Integer.parseInt(args[0]);
test.days= Integer.parseInt(args[1]);
Test test2 = new Test();
test2.trails= 5;
test2.days= 2;
Command cmd = new Command();
cmd.doSomething(test);
cmd.doSomething(test2);
cmd.doSomething(test);
}
}
}
public class Command {
Test lastTested;
public void doSomething(Test data) {
lastTested = data;
System.out.println( "working with "+ lastTested );
}
}
In the example above, you create an instance of Test that you fill with data.
Then you create an instance of Command, that will save in its state the last executed Test instance, then print the test instance data through its toString() method.
You can create a second instance of Test with other data and pass it to the same cmd (Command instance's method doSomething()). You will then see that the instance that is inside cmd changed, but getting back to your first instance test kept the values as expected