Answer to Question #240835 in Java | JSP | JSF for sandyJay

Question #240835

The statements below shows the declaration of an array:

 

String[] Municipality ={”Steve Tshwete”, “Nkomazi”, “City of Mbombela”, “Govan Mbeki”};

 

1) Make use of a loop of your choice and write statement(s) that will display all array elements indicating the Municipality’s name starting from: 

 

Municipality 1: Steve Tshwete

Municipality 2: Nkomazi

etc



1
Expert's answer
2021-09-23T17:48:02-0400
public class Main
{
	public static void main(String[] args) {
		String[] Municipality ={"Steve Tshwete", "Nkomazi", "City of Mbombela", "Govan Mbeki"};
		for(int i=0;i<4;i++){
		    System.out.println("Municipality "+(i+1)+": "+Municipality[i]);
		}
	}
}

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