• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Little Silly but not able to get

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class Boo {

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.
 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.)
reply
    Bookmark Topic Watch Topic
  • New Topic