CONSTRUCTOR

Cards (16)

  • special method that is used to create and initialize an object.
    CONSTRUCTOR
  • Using the ___ keyword calls a constructor.
    new
  • A constructor does not have a return type.
  • A constructor can call methods within its class.
  • belong to a class as a whole and not to an individual object.
    Static variables and methods
  • A ___ is shared by all the objects of its class.
    static variable
  • A static variable can be public or private.
  • Static variables that are not constants should normally be private and should be accessed or changed only by accessor and mutator methods.
  • A static method is a method that can be invoked without using any object. It is invoked by using the class name instead of an object name.
  • ·       A static method is written with the static keyword in the heading of the method definition.
  • When you call a static method, you write the class name instead of the object name
  • A static method cannot reference an instance variable of the class. It cannot invoke a non-static
  •   The predefined Math class provides a number of standard mathematical methods.
  • ·       occurs when multiple methods have the same name within the same class.
    overloading
  • This is done by having different method definitions in the methods’ parameter lists.
    overloading
  • A method’s name and the number and types of its parameters are called the method’s _____
    signature