title: Getter function not returning value when accessed from another class
body: <p>I have a class as follows:</p>
  
  <pre><code>public class Element extends Activity
  {
  public float mX;
      public float mY;
   public void animate(long elapsedTime) 
      {
          mX += mSpeedX * (elapsedTime / 20f);
          mY += mSpeedY * (elapsedTime / 20f);
          setmX(mX);
          setmY(mY);
          checkBorders();
      }
  public void setmX(float mX) 
  {
  Log.i("this.mX","mY at setmX read is :"+this.mX );      **//Line 1**
          this.mX = mX;
      }
  public float getmX() {
          Log.i("mX","mX in getmX read is :"+mX );    **//Line 2**
          return mX;
      }
  
      public void setmY(float mY) {
  
          this.mY = mY;
          Log.i("this.mY","mY at setmY read is :"+this.mY );  **//Line 3**
      }
  
      public float getmY() {
          Log.i("mY","mY in getY read is :"+mY );    **//Line 4**
  
          return mY;
      }
  }
  </code></pre>
  
  <p>I have another class</p>
  
  <pre><code>public class Panel extends SurfaceView implements SurfaceHolder.Callback
  {
  int x = 100;
      int y = 0;
  public float xval;
      public float yval; 
  @Override
      public boolean onTouchEvent(MotionEvent event) 
      {
          Element element = new Element();
          float x = event.getX();
          float y = event.getY();
          Log.i("x","x in panel is :"+x);
          //toast tos = new toast();
  
          xval = element.getmX();
          Log.i("xval","xval in playactivity obtained is :"+xval );   **//Line 5**
          yval = element.getmY();
          Log.i("yval","yval in playactivity obtained is :"+xval );    **//Line 6**
  return super.onTouchEvent(event);
  }
  </code></pre>
  
  <p>Lines 2, 4, 5, and 6 are showing values as zero. Which I don't want to. Below is the logcat image.
  <img src="https://i.stack.imgur.com/kv5Dn.png" alt="enter image description here"></p>
  
  <p><strong>Have I made error in the access Specifiers?</strong></p>