my dog learned polymorphism*
The moose likes Mock Exam Errata and the fly likes Errata - John Meyers Exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Errata - John Meyers Exam" Watch "Errata - John Meyers Exam" New topic
Author

Errata - John Meyers Exam

Najmunnisa Sageer
Greenhorn

Joined: May 18, 2008
Posts: 9
Hi,

First of all let me thank for the free online John Meyers mock exam.This exam has helped me a lot in improving my generics knowledge.

In one of the mock question

class test
{
int x; test(int input) { x = input; }
public static void main( String args[] )
{
System.out.println( new test(3).equals(new test(3)) );
}
public boolean equals( Object o)
{
return ( (test)o ).x == x;//1
}
}

Its a compiler error on the line 1 and the answer is displayed as
"Prints true".


Najmunnisa Sageer.
Arijit Daripa
Ranch Hand

Joined: Aug 09, 2008
Posts: 142
Originally posted by Najmunnisa Sageer:
Hi,

First of all let me thank for the free online John Meyers mock exam.This exam has helped me a lot in improving my generics knowledge.

In one of the mock question

class test
{
int x; test(int input) { x = input; }
public static void main( String args[] )
{
System.out.println( new test(3).equals(new test(3)) );
}
public boolean equals( Object o)
{
return ( (test)o ).x == x;// 1
}
}

Its a compiler error on the line 1 and the answer is displayed as
"Prints true".


Najmunnisa Sageer.



Everything is OKAY.
Compiler is happy and proper output is displayed.
[ August 18, 2008: Message edited by: ARIJIT DARIPA ]

SCJP 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Errata - John Meyers Exam
 
Similar Threads
Interface instant variables
Inquisition Mock - Doubt
Why varags method called first
Comparable or Comparator
Doubt in john meyers' question...