Tutorial # 8 : Constructors

1. Constructors

     Each time an object is created using new() keyword at least one constructor (it could be default constructor) is invoked to assign initial values to the data members of the same class.



  Type Of Constructors

    1.1  No-argument constructor: A constructor that has no parameter is known as default constructor. If we don’t define a constructor in a class, then compiler creates default constructor(with no arguments) for the class. And if we write a constructor with arguments or no-arguments then the compiler does not create a default constructor. Default constructor provides the default values to the object like 0, null, etc. depending on the type.



    1.2  Parameterized Constructor: A constructor that has parameters is known as       
            parameterized constructor. If we want to initialize fields of the class with your own    
            values, then use a parameterized constructor.

     Practice Code Here :- Code 1
                                            Code 2


Comments

  1. Look at the way my acquaintance Wesley Virgin's report launches in this SHOCKING AND CONTROVERSIAL video.

    As a matter of fact, Wesley was in the military-and shortly after leaving-he found hidden, "self mind control" tactics that the CIA and others used to get anything they want.

    As it turns out, these are the EXACT same tactics many celebrities (especially those who "come out of nothing") and the greatest business people used to become wealthy and famous.

    You probably know how you use less than 10% of your brain.

    Really, that's because most of your brain's power is UNTAPPED.

    Maybe this thought has even taken place INSIDE OF YOUR own brain... as it did in my good friend Wesley Virgin's brain about seven years back, while riding a non-registered, beat-up garbage bucket of a car without a license and with $3.20 in his pocket.

    "I'm so fed up with going through life check to check! Why can't I become successful?"

    You've been a part of those those thoughts, ain't it so?

    Your very own success story is going to be written. All you have to do is in YOURSELF.

    Take Action Now!

    ReplyDelete

Post a Comment