Fwd: betcha won't get these right: Do them 4 monday see what you get.

2 views
Skip to first unread message

CanadianGreenBeret

unread,
Dec 17, 2005, 12:26:29 AM12/17/05
to Carro...@googlegroups.com
---------- Forwarded message ----------
From: Jake Boeckerman <ebecke...@gmail.com>
Date: Dec 16, 2005 9:28 PM
Subject: betcha won't get these right
To: Canada Joe <canadiang...@gmail.com>, Me <ebecke...@gmail.com>


The following code appears in the main method of a properly defined
Java class. assume that all necessary imports have been called.
There are also local, overloaded methods to replace System.out.print()
and System.out.println() called SOP() and SOPL() respecitvely.
Spaces have replaced the tabs for readibility - Google's tabs are to big.


String a="Hello";
String b="Hello";

if(a.equals(b))
SOPL(1);
if(a==b)
SOPL(2);

b="Hello World".substring(0,5);

if(a.equals(b))
SOPL(3);
if(a==b)
SOPL(4);

if(b.equals("Hello"))
SOPL(5);
if(b=="Hello")
SOPL(6);

if(a.equals("Hello"))
SOPL(7);
if(b=="Hello")
SOPL(8);

It seems odd, I know. You'll probably think that I am asking a trick
question. Do not worry, I am. An explination is available on page
194 of the Big Java book. have fun!

-Jake

--
<font size = "4", color = "red"><i>CanadianGreenBeret</i></font>

Reply all
Reply to author
Forward
0 new messages