there are 6 groups {3, "1", "2"}, {4, "3", "4"}, {3, "1", "2"}, {2, "2"}, {3, "5", "2"}, {2, "one", "2"}. Please use Java to store the above six sets of data and print the data that is not repeated with the first group of data to the screen.
my idea is to do this through the char array
here is my code:
char[] charOne={3,"",""};
char[] charTwo={4,"",""};
char[] charThree={3,"",""};
char[] charFour={2," ",""};
char[] charFive={3,"",""};
char[] charSix={3,"",""};
List<char[]> charList = new ArrayList<>();
charList.add(charTwo);
charList.add(charThree);
charList.add(charFour);
charList.add(charFive);
charList.add(charSix);
for (char[] charTemp : charList) {
for (int i = 0;i<3;iPP){
if (charTemp[i]==charOne[i]){
}else{
for (char c : charTemp) {
System.out.print(c);
}
System.out.println();
break;
}
}
}
but I found a problem is that when printing in the console, 3 in the char array will become Unicode encoding, so that the printed data can not be displayed. Moreover, I feel that this way of writing violates the meaning of the topic, because the input of the data has changed from double quotation marks to single quotation marks.
do the gods have a better solution?