What is the output of the following code?
public class Main { public static void main(String[] args) { String mgr1 = "Paul & Harry's new office"; StringBuilder emp = new StringBuilder("Harry"); System.out.println(mgr1.contains(emp)); } }
a
Method contains()
accepts a method parameter of type CharSequence, and so an object of class StringBuilder is acceptable (class StringBuilder implements the interface CharSequence).
Method contains()
returns true, if the specified String equivalent can be found in the String object on which this method is called.