=============== Code ==================
Package com.cratd;
Import Java.util.Random;
public class Mymain {
/**
* @param args
*/
public static void Main (string[] args) {
TODO auto-generated Method Stub
int A;
Int[] B = new Int[5];
int[] x = new INT[3];
Int[] [] y= new INT[3] [5];
for (int i=0;i<3;i++) {
for (int j=0;j<5;j++) {
Y[i][j]=j+i;
}
}
for (int i=0;i<3;i++) {
for (int j=0;j<5;j++) {
System.out.print (y[i][j]+ "");
}
System.out.print ("\ n");
}
System.out.print ("\ n");
System.out.print ("\ n");
System.out.print ("\ n");
for (int i=0;i<5;i++) {
for (int j=0;j<3;j++) {
System.out.print (y[j][i]+ "");
}
System.out.print ("\ n");
}
int p=0;
Char ch= ' B ';
String s1= "Celloword";
String s2= "word";
Equalsignorecase
System.out.print (s1.equalsignorecase (S2));
System.out.print ("\ n");
CompareTo
System.out.print (S1.compareto (S2));
System.out.print ("\ n");
Startwith
System.out.print (S1.startswith (S2));
System.out.print ("\ n");
Endwith
System.out.print (S1.endswith (S2));
System.out.print ("\ n");
IndexOf
System.out.print (S1.indexof ("w"));
System.out.print ("\ n");
CharAt
System.out.print (S1.charat (5));
System.out.print ("\ n");
Substring
System.out.print (S1.substring (5));
System.out.print ("\ n");
System.out.print (s1.substring (3,6));
System.out.print ("\ n");
Concat
System.out.print (S1.concat (S1));
System.out.print ("\ n");
Replace
System.out.print (S1.replace ("word", "?"));
System.out.print ("\ n");
Trim
String s3= "word";
System.out.print ("^" +s3+ "^");
System.out.print ("\ n");
System.out.print (S3.trim ());
System.out.print ("\ n");
toUpperCase toLowerCase
String s4= "CRATD";
System.out.print (S4.touppercase ());
System.out.print ("\ n");
System.out.print (S4.tolowercase ());
System.out.print ("\ n");
}
}
============== Output ===================
0 1 2) 3 4
1 2 3) 4 5
2 3 4) 5 6
0 1 2
1 2 3
2 3 4
3 4 5
4 5 6
False
-20
False
True
5
W
Word
Low
Cellowordcelloword
Cello?
^ Word ^
Word
Cratd
Cratd
This article from "Boulevard to Jane, Heaven and Earth in My Heart" blog, please be sure to keep this source http://8392460.blog.51cto.com/8382460/1771574
Sting string manipulation