fb like button code

Constants

  • To declare constant use const keyword 
  • class Calendar1
    {
        public const int months = 12;
    }
     
  •  We cannot change value of constant during run time once it has been declared & assigned
  • We do not use the static keyword to declare them
  • Multiple constants of the same type can be declared at the same time for example
  • class Calendar2
    {
        const int months = 12, weeks = 52, days = 365;
    }
     
     

0 comments:

Facebook