wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String.endsWith() 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 "String.endsWith()" Watch "String.endsWith()" New topic


umang bhartia
Ranch Hand

Joined: Sep 29, 2000
Posts: 60
class end
public static void main(String[] args)
Output: True
Can any one explain how the output is true
Axl Rose

Joined: Dec 18, 2000
Posts: 16
note that the method endsWith(""), takes actually an empty string, or a string that contains nothing, not a single character.
and if we compare it with what the java doc say about the method endsWith(String argument)in the String class:
"Note that the result will be true if the argument is the empty string or is equal to this String object as determined by the"
so the answer will be true.
I agree. Here's the link: http://aspose.com/file-tools
subject: String.endsWith()
It's not a secret anymore!