Enhanced for loop is showing error in my eclipse

error:
Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Syntax error, ‘for each’ statements are only available if source level is 1.5 or greater

at section3_FunctionAnd1D_Array.ArrayDemoCode.main(ArrayDemoCode.java:41)

my code:

// declare
int[] arr = null;
System.out.println(arr);

	// allocate space
	arr = new int[5];
	System.out.println(arr);

	// get
	System.out.println(arr[0]);
	System.out.println(arr[1]);
	System.out.println(arr[2]);
	System.out.println(arr[3]);
	System.out.println(arr[4]);

	// set
	arr[0] = 10;
	arr[1] = 20;
	arr[2] = 30;
	arr[3] = 40;
	arr[4] = 50;

	// //get
	// System.out.println(arr[0]);
	// System.out.println(arr[1]);
	// System.out.println(arr[2]);
	// System.out.println(arr[3]);
	// System.out.println(arr[4]);

// for (int i = 0; i < arr.length; i++) {
// System.out.println(arr[i]);
//
// }

	for(int val : arr){
		System.out.println(val);
	}

refer to this link:

Hi Nipun,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.