Q:

Difference ways to assign variable in java?

Which ways is the best to assign java variables? And What is the differences? See this;
   public class Test {
       private String testString;

       //getter & setter here.

       public void testMethodOne() {
            this.testString = "Hello World!";
       }

        public void testMethodTwo() {
            testString = "Hello World!";
       }

        public void testMethodThree() {
            setTestString("Hello World!");
       }
   }

Which is the best,  this.testString = "xxx" or testString = "xxx" or setTestString("xxx")?

A:

I recommended you prefix your class attributes with "this". This way you would have a better view of member variables vs local variables.
And use getters/setters when you can't access class attributes directly (access them from another class). 

