小编Ami*_*har的帖子

局部变量范围的问题.怎么解决?

尝试statemet.executeUpdate()在我的代码中执行时,我收到以下错误:

Local variable statement defined in an enclosing scope must be final or effectively final.
Run Code Online (Sandbox Code Playgroud)

到目前为止这是我的代码:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;.

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class a1 {

    protected Shell shell;
    private Text text;
    private Text text_1;
    private Text text_2;
    private Text text_3;

    /**
     * Launch the application.
     * @param args
     */
    public static void main(String[] args) {
        try { …
Run Code Online (Sandbox Code Playgroud)

java scope

54
推荐指数
2
解决办法
15万
查看次数

使用mongodb在java中createIndex()和ensureIndex()之间的区别

使用MongoDB createIndex()ensureIndex()Java 之间有什么区别?我用Google搜索了这个,但没有得到满意的答案.

java mongodb mongodb-java

41
推荐指数
2
解决办法
2万
查看次数

获取拨号 tcp:从容器内的服务访问互联网时的 i/o 超时

我正在使用 PubNub (GO SDK) 发布/订阅服务来接收消息,但即使我能够google.com从容器内部ping 通,我也没有收到任何消息。

在 Pubnub 日志中,每次我的程序尝试连接到源(Pubnub 服务器)时,我都会收到“拨号 tcp:i/o 超时”错误。我猜这是由于主机或容器中的 Internet 连接速度较慢。

我应该怎么做才能解决这个错误?

go pubnub docker

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

sbcl lisp中没有发生逻辑运算

我想让程序通过add和shift方法将两个数相乘.我已经在sbcl lisp中编写了这段代码.

(defun calculator (num1 num2)
  (write-line "In the function")
  (let ((res 0))
    (loop for lpr from 0 to 63
          do (let ((end-bit (logand num2 1)))
               (format t "res is : ~a. ~%" num2)
               (if (= end-bit 1)
                   (+ res num1))
               (ash num2 -1)
               (ash num1 1)
               (format t "after ash ~a ~%"num2)))
    (format t "result is ~a.~%" res)))

(let ((num1 (progn
              (write-line "Enter first number: ")
              (finish-output)
              (read)))
      (num2 (progn
              (write-line "Enter second number: ")
              (finish-output)
              (read))))
  (if (or …
Run Code Online (Sandbox Code Playgroud)

lisp bit-manipulation common-lisp

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