parseLong() Method in java

Java Programming Language / Number Class in java

3852

Program:

<code><font  size=2 face="Consolas"><font color="#FF0000"><b>public class </b></font><font color="#0066CC"><b>ParseLong </b></font><b>{

   </b><font color="#FF0000"><b>public </b></font><font color="#800000"><b>static void </b></font><font color="#0066CC"><b>main</b></font><b>(</b><font color="#0066CC"><b>String args</b></font><b>[]) {

      </b><font color="#800000"><b>long </b></font><font color="#0066CC"><b>x </b></font><b>=</b><font color="#0066CC"><b>Long</b></font><b>.</b><font color="#0066CC"><b>parseLong</b></font><b>(&quot;298798&quot;);

      </b><font color="#0066CC"><b>System</b></font><b>.</b><font color="#0066CC"><b>out</b></font><b>.</b><font color="#0066CC"><b>println</b></font><b>(</b><font color="#0066CC"><b>x</b></font><b>);

   }
}

</b><i>/*

This method is used to get the primitive data type of a certain String.
parseLong(String s) - This returns an long (decimal only).
s - This is a string representation of decimal.

*/
</i></font>
</code>

Output:

298798
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.