File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Errata - John Meyers Exam

 
Najmunnisa Sageer
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 142
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic