Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Why does is declaration of a string variable in Java capitalized?</strong></p> <p>The <code>String</code> type is capitalized because it is a <strong>class</strong>, like <code>Object</code>, not a primitive type like <code>boolean</code> or <code>int</code> (the other types you probably ran across).</p> <p>As a class, the <code>String</code> follows the <a href="http://www.oracle.com/technetwork/java/codeconventions-135099.html" rel="nofollow">Naming Convention for Java</a> proposed by Sun. In short, that coding style dictates that <strong>UpperCamelCase</strong> be used for classes (<em>"Class names should be nouns, in mixed case with the first letter of each internal word capitalized"</em>) and <strong>lowerCamelCase</strong> be used for instances and methods.</p> <p><strong>What's the basic difference between <code>String</code> and the primitive types?</strong></p> <p>As an object, a <code>String</code> has some advantages, like properties and methods that can be called directly to them (like the famous <code>length()</code>, <code>replace()</code> and <code>split()</code>). None of the primitive types have that.</p> <p><strong>What about wrapper classes?</strong></p> <p>The other primitive types have equivalent <strong><em>wrapper</em></strong> classes, like <code>Integer</code> for <code>int</code> and <code>Boolean</code> for <code>boolean</code>. They will allow you additional functions.</p> <p>Since Java 1.5, the conversion from an <code>int</code> to an <code>Integer</code> is made <em>almost</em> seamlessly. This is called <a href="http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html" rel="nofollow">autoboxing</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload