View RSS Feed

Recent Blogs Posts

  1. Initializing Fields

    by , 04-26-2012 at 05:52 PM
    For a field, initial value could be provided often in its declaration:
    Java Code:
    public class BedAndBreakfast {
        // initialize to 10
        public static int capacity = 10;
        // initialize to false
        private boolean full = false;
    It would be working well when value of the initialization is present & can be placed at 1 line. But certain limitations are associated with such initialization due to its simplicity. If some ...