Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  PupilsMarksMap
Language: JAVA
Code:
import java.io.*;
import java.util.HashMap;
import java.util.Map;

public class PupilsMarksMap
{
    public static void main (String[] args)
    {
    Map pupil = new HashMap();
    
    pupil.put("Ahmad", 80);
    pupil.put("Tareq", 72);
    pupil.put("Naif", 91);
    pupil.put("Ali", 66);
    pupil.put("Riyad", 74);
    pupil.put("Fahad", 62);
    pupil.put("Saad", 78);
    pupil.put("Sultan", 85);
    
    System.out.println ("Total Pupil :"+pupil.size());
    for(Object key: pupil.keySet())
    System.out.println(key + " - " + pupil.get(key));
    System.out.println();
}
}
     
Comments: