很抱歉打扰你们这样的事情,但是新的就是这个。有一个可怕的时间让Classes产生任何输出。在3个IDE中试过这个,它没有输出。可能是我不包括图书馆或我的IDE没有设置正确。这是我的简单程序。
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import javax.net.ssl.SSLSocketFactory;
import lotus.domino.AgentBase;
public class JavaAgent extends AgentBase {
// Change these settings below to your setup as required.
static final String hostName = "server1.testdomain.com";
static final String urlFilepath = "/test/poidemo.nsf/xagentmail.xsp";
static final int sslPort = 443;
public void NotesMain() {
try {
final SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
final Socket socket = factory.createSocket(JavaAgent.hostName, JavaAgent.sslPort);
final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
final BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
final StringBuilder sb = new StringBuilder();
sb.append("GET ");
sb.append(JavaAgent.urlFilepath);
sb.append(" HTTP/1.1\n");
final String command = sb.toString();
sb.setLength(0);
sb.append("Host: ");
sb.append(JavaAgent.hostName);
sb.append("\n\n");
final String hostinfo = sb.toString();
out.write(command);
out.write(hostinfo);
out.flush();
in.close();
out.close();
socket.close();
} catch (final Exception e) {
// YOUR_EXCEPTION_HANDLING_CODE
}
}
}
答案 0 :(得分:1)
为了定义代码块,必须在Python中使用适当的缩进 在你的情况下你应该
q
在第5行和第6行中的class Hello: #line 1
def printHello(self): #line 2
print ("hello") #line 3
#line 4
x = Hello() #line 5
x.printHello() #line 6
之前没有空格,第3行的x
也应该缩进,因为它是print()
函数的一部分(就像{{1} }}是printHello()
)的一部分。