File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes program needs to be explained Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "program needs to be explained" Watch "program needs to be explained" New topic

program needs to be explained

Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127
the below program needs to be explained

venkat ram simha

class SaveMe implements Serializable{
transient int x;
int y;
SaveMe(int xVal, int yVal) {
x = xVal;
y = yVal;
public int hashCode() {
return (x ^ y); //Legal, but not correct to
// use a transient variable
public boolean equals(Object o) {
SaveMe test = (SaveMe)o;
if (test.y == y && test.x == x) { // Legal, not correct
return true;
} else {
return false;
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516

can you tell which part you don't understand.

transient, serializable, hashCode, ==, &&, equals, ^, passing primitives to fct, the use of transient variables...

So many things in the code, and there is no main.

I agree. Here's the link:
subject: program needs to be explained
It's not a secret anymore!