vivek kumar vivek kumar -4 years ago 89
Java Question

Java- What is the definition of intValue()

How the

method of
class works, means how the actual parameter is passed.

And where is the definition of this method. (I have searched
class and
class but found only declaration but no definition.)

Also I want to know in detail how statement like
work in Java (how two consecutive method call work).


Answer Source

The definition is in the class java.lang.Integer line 892 of my source version (1.8).

 * Returns the value of this {@code Integer} as an
 * {@code int}.
public int intValue() {
    return value;

This value is passed in via the constructor, in my source version around line 835

 * The value of the {@code Integer}.
 * @serial
private final int value;

 * Constructs a newly allocated {@code Integer} object that
 * represents the specified {@code int} value.
 * @param   value   the value to be represented by the
 *                  {@code Integer} object.
public Integer(int value) {
    this.value = value;

Your final question is unclear to me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download