以下实例演示了如何使用 contains () 方法来查找数组中的指定元素:
Main.java 文件
以上代码运行输出结果为:
objArray 的数组元素:[common1, common2] objArray2 的数组元素:[common1, common2, notcommon, notcommon1] objArray 是否包含字符串common2? : true objArray2 是否包含数组 objArray? :false