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 Little Silly but not able to get 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 "Little Silly but not able to get " Watch "Little Silly but not able to get " New topic

Little Silly but not able to get

Kasak Tahilramani
Ranch Hand

Joined: Apr 06, 2006
Posts: 45
public class Boo {

Boo(String s){}
public static void main(String[] args) {
System.out.println("john".equals(new Boo("john")));//false
char[] unique= {'\u0030','\u0031'};
System.out.println(unique[0]); //how this is giving zero as output

According to me ans should be true and '\u0030' .Can someone explain.
Got stuck in these little one's after doing better in other section.
Anton Uwe
Ranch Hand

Joined: Jan 10, 2007
Posts: 122
According to me ans should be true...

Could you explane us why you think a Boo-object should be equal to a String object?

'/u0030' is the character 0.
marc weber

Joined: Aug 31, 2004
Posts: 11343

"john" IS-A String. Not only is Boo not a String, it doesn't even HAVE-A String. (Boo's constructor takes a String, but doesn't do anything with it.)

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: Little Silly but not able to get
It's not a secret anymore!