.
Home About-us Privacy Policy Contact-us Services

Friday, October 16, 2015

Java - String Function Program Example - Allprogramexample

ad+1

String Function Example
class stringfun
{
public static void main(String[] args)
{
String s="cjsoftech";
String s2="iitsdpatiala";
String s3=s2.substring(2,5);
String s4=s.concat(s2);
int i;
int j;
System.out.println("hello "+s);
System.out.println("length of s "+s.length());
System.out.println("s2.subString(2,5) "+s3);
System.out.println("s2.charAt(2) "+s2.charAt(2));
i=s.compareTo(s2);
System.out.println("s.compareTo(s2) "+i);
System.out.println("concate  "+s4);
j=s.indexOf('o');
System.out.println("index of o "+j);
String s5=s.replace('s','S');
System.out.println("after replace "+s5);
String s6=s.toUpperCase();
System.out.println("s6 uppercase "+s6);
String s7=s6.toLowerCase();
System.out.println("s6 lowercase "+s7);
int m=123;
String s8=String.valueOf(m);
System.out.println("valueof "+s8);
}
}






0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates