Class 10 ICSE - Java

Class 10th Java aims to empower students by enabling them to build their own applications introducing some effective tools to enable them to enhance their knowledge, broaden horizons, foster creativity, improve the quality of work and increase efficiency.
It also develops logical and analytical thinking so that they can easily solve interactive programs. Students learn fundamental concepts of computing using object oriented approach in one computer language with a clear idea of ethical issues involved in the field of computing
Class 10th java topics includes revision of class 9th, constructors, user-defined methods, objects and classes, library classes , etc.

Pure / Impure Methods

Pure Methods




A method is considered as pure method if :

(i) It does not change the value of the argument passed to it.
(ii) It always returns the same value when the same arguments are passed to it.

Invoking a pure method has no side effects (i.e. changing the state of an object , modifying the value of the argument)


(i) In the above example the value of the actual parameter remains the same before and after invoking the method. The value of the parameter (i.e. 6) is passed to the method EvenOdd() where it is processed , in the course of action the value of the actual parameter does not change even if there is a change in the value of the formal parameter.
(ii) Irrespective of how many times the method EvenOdd() is called it will return the same value when the same argument is passed.

Impure Methods




A method is considered as impure method if :

(i) It does change the value of the argument passed to it.
(ii) It does not always returns the same value when the same arguments are passed to it.

Invoking a impure method has side effects (i.e. changing the state of an object , modifying the value of the argument)


In the above example each time the increment() method is invoked :
(i) The state of the object changes, i.e. the global variable count is updated.
(ii) It will return a different value even if the same argument is passed.

Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com