My goal is to return a value from local variable that I need to set first by calling a method. It could sound dumb, sorry, I do not have much practice with java yet, tried googling for 2 hours and haven't found the solution.
Step by step goal:
- Create local String variable in constructor
- Set its value
- Create method that will return this value
This is what I got yet:
public class TestString{
public TestString(){
}
public String name;
public TestString (String name){
this.name=name;
}
public String toString() {
return this.name;
}
}