Answer to Question #276121 in Java | JSP | JSF for Candy

Question #276121

7. Please complete the following codes (4 marks)

public class TestArray {

public static void main(String[] args) {

// create and initialize an array ‘myList’ with 4 elements. The values are the 4 elements are into 1.9,2.9,3.4 and 3.5

_______________________________

// Print all the array elements

for (double element: myList) {

System.out.println(element);

}

}

}

What is printed on execution of these methods? 


1
Expert's answer
2021-12-09T02:23:22-0500
public class TestArray {


	public static void main(String[] args) {


		// create and initialize an array ‘myList’ with 4 elements. The values are the 4
		// elements are into 1.9,2.9,3.4 and 3.5
		double[] myList = { 1.9, 2.9, 3.4, 3.5 };
		// Print all the array elements
		for (double element : myList) {
			System.out.println(element);
		}
	}


}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS