17. Define an enumeration for each of the months in the year. Use a for-each statement to display each month.
import javax.swing.JOptionPane;
public class amante{
public static void main (String[]args){
String display="";
String []months=new String[]{"January","February","March","April","May","June","July","August","September","October","November","December"};
for(String out:months){
display=display+out+"\n";
}
JOptionPane.showMessageDialog(null, display);
}
}
Walang komento:
Mag-post ng isang Komento