原题链接:Leetcode 419. Battleships in a Board
Given an m x n matrix board where each cell is a battleship X or empty ., return the number of the battleships on board.
Battleships can only be placed horizontally or vertically on board. In other…
HashSet子类依靠()方法区分重复元素。 A toString(),equals() B clone(),equals() C hashCode(),equals() D getClass(),clone()
答案:C 解析: 先调用对象的hashcode方法将对象映射为数组下标,再通过equals来判断元素内容是否相同
以下程序执行的结果是: class X{…