- // This program mainly describes the two simple methods for getting different elements from the two arrays.
- // One
- Public class test {
- /**
- * @ Param ARGs
- */
- Public static void main (string [] ARGs ){
- String [] KK = {"C", "B", ""};
- String [] HH = {"A", "B "};
- String STR = "";
- For (Int J = 0; j <HH. length; j ++ ){
- STR + = HH [J];
- }
- For (INT I = 0; I <KK. length; I ++ ){
- If (Str. indexof (kk [I]) =-1 ){
- System. Out. println (kk [I]);
- }
- }
- }
- }
- // Two
- // The following method is similar to the C Language
- Public class bijiao {
- /**
- * @ Param ARGs
- */
- Public static void main (string [] ARGs ){
- // Todo auto-generated method stub
- String kk [] = {"C", "A", "B "};
- String HH [] = {"A", "B "};
- String mm [] = new string [Kk. Length]; // an empty character array is opened.
- Mm = KK; // copy it to a temporary Array
- For (Int J = 0; j <KK. length; I ++)
- For (INT I = 0; I <KK. length; I ++)
- If (Mm [J] = HH [I]) // compare all data in two cycles.
- Mm [J] = NULL; // clear the same elements of the temporary array if the values are the same
- For (Int J = 0; j <length; j ++ ){
- If (Mm [J]! = NULL) // print out different array elements
- System. Out. println (kk [J]);
- }
- }
Select column from table
And then obtain them cyclically by line.