当前位置:首页
开发技术指南» 文章正文
    引言:

 ·关于top 1 的返回值    »显示摘要«
    摘要: 请问语句中包含 top 1 ,是否返回值就一定是唯一呢? 最近看了一份文章,里面说道top n 的用法,里面提到: 返回出现在由 order by 子句指定的起始和结束范围内的一定数量的记录。假定希望得到 1994 年级中前 25 名学生的名字: select top 25 firstname, lastname from students where graduationyear = 1......
 ·求助关于自学考试的问题    »显示摘要«
    摘要: 有哪位兄弟知道一些深圳的自考学校的资料,要求没有年龄、学历限制,地点在深圳,然后是费用明细、招生时间等. 知道的跟帖告诉我 或者发mail给我 可以吗? 我的mail: hujiejun@szapsoft.com 谢谢了!!! ......


Class Cast

 
  新手学写程序,统计一个特定的字符在一个二维数组中出现的次数:  
  class   Position  
  {  
  public   int   x,   y;  
  public   Position(){   x   =   y   =   0;   }  
  public   Position(int   X,   int   Y)   {   x   =   X;   y   =   Y;   }  
  }  
  ...  
   
  Stack   stack   =   new   Stack();  
   
  ...  
  stack.add(new   Position(i,   j));  
  ...  
   
  Position   pos[]   =   stack.toArray();  
   
  编译时出错:  
  Statistic.java:79:   incompatible   types  
  found       :   java.lang.Object[]  
  required:   Position[]  
                                  Position   pos[]   =   move.toArray();  
   
  怎么改?  
   
 

NO.1   作者: famousboy

stack.toArray()返回的是Object[],父类型复制给子类型必须显式转换。  
   
  Object[]   temp   =   stack.toArray();  
  Position   pos[]   =   new   Position[i];  
  for(int   i=0;   i<temp.length;   i++)  
  {  
          pos[i]   =   (Position)temp[i];  
  }


 ·低端vpn路由器    »显示摘要«
    摘要: 想找一款低端vpn路由器,vpn功能方面就不多说,关键是要有远程web管理以及权限管理。比如要放在分支机构使用,可以给当地的使用者一定权限,让他配置基本的连接,但vpn方面的配置却不想让他看到,而是由我远程管理 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE