Java With Numbers

Computer Science Level pending

WHAT IS THE SUM OF THE PRINTED NUMBERS IN THE CODE BELOW? IF THE IS A COMPILING ERROR, TYPE 0. This is code in Java 7. Also assume that we already imported the Java classes HashMap and Map and there is no class statement...

public static void main(String[] args) 
{

    final Map<Character, Integer> map;
    final String str = "hello world";
    map = new HashMap<>();  
    map.put('a', 1);
    map.put('b', 2);
    map.put('c', 3);
    map.put('d', 4);
    map.put('e', 5);
    map.put('f', 6);
    map.put('g', 7);
    map.put('h', 8);
    map.put('i', 9);
    map.put('j', 10);
    map.put('k', 11);
    map.put('l', 12);
    map.put('m', 13);
    map.put('n', 14);
    map.put('o', 15);
    map.put('p', 16);
    map.put('q', 17);
    map.put('r', 18);
    map.put('s', 19);
    map.put('t', 20);
    map.put('u', 21);
    map.put('v', 22);
    map.put('w', 23);
    map.put('x', 24);
    map.put('y', 25);
    map.put('z', 26);

    for(final char c : str.toCharArray())
    {
        final Integer val;

        val = map.get(c);

        if(val == null)
        {   

        }
        else
        {
            System.out.print(val + " ");
        }
    }

    System.out.println();
}

}

×

Problem Loading...

Note Loading...

Set Loading...