adplus-dvertising
frame-decoration

Question

What is the output of this program?
    class equality 
    {
        int x;
        int y;
        boolean isequal()
        {
            return(x == y);  
        } 
    }    
    class Output 
    {
        public static void main(String args[]) 
        {
            equality obj = new equality();
            obj.x = 5;
            obj.y = 5;
            System.out.println(obj.isequal);
        } 
    }

a.

false

b.

true

c.

0

d.

1

Posted under Java Programming

Answer: (b).true

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. Which of this method is given parameter via command line arguments?

Q. Which of these data types is used to store command line arguments?

Q. How many arguments can be passed to main()?

Q. Which of these is a correct statement about args in this line of code?

public static void main(String args[])

Q. Can command line arguments be converted into int automatically if required?

Q. How do we pass command line argument in Eclipse?

Q. Which class allows parsing of command line arguments?

Q. Which annotation is used to represent command line input and assigned to correct data type?

Q. What is the use of @syntax?

Q. What is Recursion in Java?

Q. Which of these data types is used by operating system to manage the Recursion in Java?

Q. Which of these packages contains the exception Stack Overflow in Java?

Q. Which of the following statements are incorrect?

Q. Which of these access specifier must be used for class so that it can be inherited by another subclass?

Q. Which is true about an anonymous inner class?

Q. Which is true about a method-local inner class?

Q. Which statement is true about a static nested class?

Q. Which constructs an anonymous inner class instance?

Q. What allows the programmer to destroy an object x?

Q. Which statement is true?