日期:2014-05-20  浏览次数:20803 次

关于API的问题
我初学JAVA   想问一个关于API的问题。
  这是java.sql.ResultSet的源代码的一部分:
package   java.sql;
import   java.math.BigDecimal;
public   interface   ResultSet   extends   Wrapper   {
boolean   next()   throws   SQLException;
  void   close()   throws   SQLException;
boolean   wasNull()   throws   SQLException;
String   getString(int   columnIndex)   throws   SQLException;
.....
....
}
它是个接口为什么它还可以这么用:
ResultSet   rs   =   stmt.executeQuery( "SELECT   a,   b   FROM   TABLE2 ");
不是说接口不能NEW吗?



------解决方案--------------------
不能new 接口 但是可以new 接口实现类
------解决方案--------------------
你看到new关键字了吗?
------解决方案--------------------
标题很吸引人!
------解决方案--------------------
接分~
------解决方案--------------------
这里没有new