Sunday, February 25, 2018

Java Program : Enumerators example

class Enums1
{
    enum Months{jan,feb,mar,apr,may}
   
    public static void main(String[] args)
    {    Months m=Months.feb;
        System.out.println(m);
    }
}

---------------------------------------------------------

command to compile the program

D:\javaprograms>javac  Enums1.java   <ENTER>

command to run the compiled program

D:\javaprograms>java Emuns1  <ENTER>

You need to save and compile your program each time you make a change in it.
Thanks
Happy programming!

No comments:

Post a Comment

Class IX IT notes: Part A, Unit 1, Session 3.

 IT notes class 9 Part A Unit 1: COMMUNICATION SKILLS session 3: VISUAL AND WRITTEN METHODS OF COMMUNICATION Q1. What is Visual Communicatio...