title: Different Ways to Call Methods from Another Class
body: <p>I am a beginner with the java language and programming as a whole. </p>
  
  <p>I understand that to call methods from another class, we call that method with: </p>
  
  <pre><code>ClassName.methodName(arguments);
  </code></pre>
  
  <p>For example, when we want to find the square root of an integer using the Math classs:</p>
  
  <pre><code>int x = 4;
  int root = (int)(Math.sqrt(x));
  </code></pre>
  
  <p>However, when we use certain methods in other classes, such as the charAt() method in the String class, we access that method using something like: </p>
  
  <pre><code>String str = "Greetings!";
  char ch = str.charAt(0);
  </code></pre>
  
  <p>This is also true for other methods in the String class such as: codePointAt() and compareTo().</p>
  
  <p>Why do we call methods differently when using methods from certain classes like the String class? How do we know when to call methods like this as opposed to the other way?</p>
  
  <p>Thanks!</p>