2:36 am - Friday April 19, 2019

Long Example Program for valueOf(String s)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
@author: candidjava
@description:  valueOf(String s) is used to a long object holding the value of specify string
*/
public class DeeValueOfStringLong
{
public static void main(String[] args) throws Exception
{
try{
String s="candid";//get the string
Long l=new Long(246);//get the long value
System.out.println(l.valueOf(s));// to return a long object holding the value of specify string
}
catch(Exception e)//if the exception occur means catch the exception
{
System.out.println(e.getMessage());//print the message
}
}
}

output:

For input string: “candid”

Filed in: Z-A All Java Codes

Comments are closed.