小编ric*_*nal的帖子

像整数数组这样的原始数据类型如何具有字段"长度"?

当原始数据类型不是类时,整数数组类型如何具有字段"长度"?例如

int a[] = {1,2,3,4};
int j = a.length;
System.out.println(j);
Run Code Online (Sandbox Code Playgroud)

java arrays

2
推荐指数
1
解决办法
1254
查看次数

Javascript,设置 onclick 方法语法

我正在查看一个操作 HTML A 标签的 javascript 代码,但我无法理解它如何设置“onclick”属性。它似乎告诉它用索引变量 j 更新 ytplayer_playitem 然后调用 ytplayer_playlazy(1000)

但是所有的括号是怎么回事?javascript 语法中的哪些细节允许像这样设置?

var a = document.createElement("a");
a.href = "#ytplayer";
a.onclick = (function (j) {
    return function () {
        ytplayer_playitem = j;
        ytplayer_playlazy(1000);
    };
})(i);
Run Code Online (Sandbox Code Playgroud)

javascript onclick

2
推荐指数
1
解决办法
6728
查看次数

这有什么不对?我得到一个java.lang.ClassCastException错误,但我看不出我出错的地方

这是我第一次真正使用列表和队列,所以这可能是一个非常简单的错误.是因为我的队列中充满了无法转换为整数的对象吗?

           //populate array
        for(int i=0; i<11; i++){
            numberarray[i] = i; 
        }
        // populate list with numbers from array
        List numList = Arrays.asList(numberarray);
        Collections.shuffle(numList);

        Queue queue = new LinkedList();
        queue.addAll(numList);

        int num1 = (Integer) queue.poll();
        assignPictures(button01, num1);
Run Code Online (Sandbox Code Playgroud)

java queue arraylist classcastexception

1
推荐指数
1
解决办法
2102
查看次数

界面最佳实践

可能是一个普遍的问题,但是有一个接口(Service)及其实现(ServiceImpl)被认为是一种不好的做法,但是ServiceImpl包含未包含在接口中的私有实用程序方法?

java implementation interface

1
推荐指数
4
解决办法
1009
查看次数

更改密码Delphi v7

Delphi v7

此代码旨在允许用户更改其密码.它似乎正确执行,但新密码未保存在密码数据字段中.我一定做错了什么,但我看不出来.

procedure TForm4.btnPswordClick(Sender: TObject);
var
  I: integer;
begin
tblLogin.First;;
for I := 0 to tblLogin.RecordCount  do
Begin
If tblLogin.FieldByName('Username').Value = Edit1.Text then
if tblLogin.FieldByName('Password').Value = Edit2.Text  then
sign2.Visible := True; //Test in this case tells the application to make Label1  
visible if the //username and password are correct
tblLogin.Next;
end;
I:= I+1;  //ends search loop of records so program can move on
If sign2.Visible = False then
begin
MessageDlg('Error Username, or Password not correct',
mtConfirmation, [mbCancel], 0);
end …
Run Code Online (Sandbox Code Playgroud)

delphi passwords delphi-7

1
推荐指数
1
解决办法
1224
查看次数

我们可以只为类创建一个Single对象

是否有可能只为该类创建单个对象?如何用Java做到这一点?

java singleton object

0
推荐指数
1
解决办法
1万
查看次数

Javascript无法在IE中运行,但所有其他浏览器都运行良好

我在我的主页上有一些推荐信,代码似乎在Firefox,Chrome和Safari中运行得很好,但在IExplorer中却没有.我正在运行IE 9.我很感激任何帮助或见解.

这是我正在使用的代码:

<div class="quotes">
    <div id="tst">
        <div id="quote"></div>
    </div>
    <br><span></span>
</div>
<div class="comment"><strong>
    <div id="tstperson"></div></strong>
</div>
<script type="text/javascript">
    var quote=new Array();
      quote[0]="An essential tool in preparation for any show. Valuable time is saved, refining vocals much earlier in the process.";
      quote[1]="Invaluable for learning vocal lines! A brilliantly simple and easy to use interface that saved me hours of time.";
      quote[2]="MixMyPart saved us almost a week of rehersal time. A brilliant invention. Singers come in less nervous and more focused."; …
Run Code Online (Sandbox Code Playgroud)

javascript internet-explorer-9

0
推荐指数
1
解决办法
774
查看次数