Hello,
I need your help once again, so far, i have this following codes and im trying to make a java program that calls an object value initialized.
public class TestClass { public String name; public int age; public void myMessage() { System.out.println("Hello I'm" + name + "and i'm" + age + "years old"); } }
what i want is to put the following codes of the object.. so once i compile and run the project it executes the value of an object from the method i defined above.
TestClass myName = new TestClass(); myName.name = "Jefferson"; myName.age = 18;
my question is, it is possible to declare or define it in the same project? or i need to do this separately?
could anyone pls help me? thanks in advance