Computer Science, asked by riya92mittal, 5 months ago

Write a valid Java statement to store the gender of 5 people as 'M' or 'F' in an array​

Answers

Answered by mrfries77
1

Answer:

public class Main {

 public static void main(String[] args) {

   char[] gender= new char[5];

   gender[0] = 'M';  gender[1] = 'M';  gender[2] = 'F'; gender[3] = 'F';

   gender[4] = 'M';

 }

}

Explanation:

First I created a char array to store the gender.

Next I populated the array with genders 'M' or 'F'.

Similar questions