Methods and Constructors - ISC Class 11 Computer Science Notes, Diagrams and Solved Questions

Methods as named operations, formal and actual arguments, why primitive arguments are copied, side effects, static variables and methods, this, constructors with new, overloading, and number problems and equation roots solved with methods.

In this chapter

  • How a method is defined, called and returns a value, and why main is static
  • Formal and actual arguments, and pass by value for primitives and references
  • Pure methods versus methods with side effects
  • Static (class) variables and methods shared by all objects
  • The current object and the keyword this
  • Constructors, the default constructor and what new returns
  • Multiple constructors, this(…) chaining and overloaded methods
  • Number problems and roots of equations by bisection and Newton-Raphson