import java.util.*;
public class map1 {
public static void main(String[] args) {
Map map = new TreeMap();
char grade[] = { 'a', 'b', 'c', 'd' };
int x = 1;
for (char c : grade) {
map.put(x, c);
x++;
}
Set s = map.entrySet();
Iterator i = s.iterator();
while (i.hasNext()) {
System.out.println(i.next());
}
}
}
Output :
1=a 2=b 3=c 4=dIf you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.