import java.util.*; public class CharacterSets { public static void main(String[] args) { int numArgs = args.length; // A set keeping track of all characters previously encountered. Set encountered = new HashSet(); // (1) // For each program argument in the command line ... for (int i=0; i Running the program with the following arguments:java CharacterSets i said i am maidsresults in the following output:[i] and [] are disjunct. [d, a, s, i] is a superset of [i] [i] is a subset of [d, a, s, i] [a, m] and [d, a, s, i] have [a] in common. [d, a, s, m, i] is equivalent to [d, a, s, m, i]
Collection and sharing of, interview questions and answers asked in various interviews, faqs and articles.....
Example Using Sets
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment