Q:

Explain why the Wrong Output Happened?

public class ArrayIntro
{
    public static void main(String[] args)
    {
        int[] a;
        a=new int[10];
        Scanner sc =new Scanner(System.in);
        for(int i=0;i<10;i++)
        {
            a[i]=sc.nextInt();  
        }
        for(int e:a)
        {
            System.out.print(e+' ');
        }
    }
}

Input:1 2 3 4 5 6 7 8 9 10
Output:33343536373839404142
Its mean it added 32 to each number

A:

Just try with below code.
As you are printing sout inside for loop, it's printing sum of number and Space( ' '). And space have ASCII value of 32, so you are able to see every element with added value of 32.
For ASCII Or Unicode you can refer this link, it will help you.
Simply you put something like this System.out.print(new Integer(' '));, it will print 32.
If you want to add space only then go with double quote.
System.out.print(e+" ");.
Single quote consider as character and charater added with Integer will summing up with their ASCII code.
public static void main(String[] args)
    {
        int[] a;
        a=new int[10];
        Scanner sc =new Scanner(System.in);
        for(int i=0;i<10;i++)
        {
            a[i]=sc.nextInt();  
        }
        for(int e:a)
        {
            System.out.print(e+" ");
        }
    }

