Hello, you ______________Mr. James.I’ve heard a lot about you from your colleagues.
A.must be
B.will be
C.may be
D.might be
A.must be
B.will be
C.may be
D.might be
有下列程序段 public class fun { public static void main(String args[]) { char b[]="Hello,you"; b[5] = 0; System.out.println(s); } 执行此程序后,得到的输出结果是()。
A.Hello, you
B.Hello0you
C.Hello
D.0
A.repaint
B.println
C.paint
D.show
下列内部类的正确用途是()。 btnn.addActionListener(new //注册监听器 ActionListener() { public void actionPerformed(ActionEvent event) { String s=input.getText(); output.setText("Hello"+s+”,Welcome You!"); } });
A.用于访问外部类的数据
B.用于进行事件处理
C.隐藏起来不被同一包中的其他类所见
D.生成事件适配器
A、Thank you for your purchase,I have prepared you some gifts,which will be sent to you along with the goods.Sincerely hope you like it.I will give you a discount,if you like to purchase other products
B、Dear friend,your package has been send out,the tracking NO.is 0000000000 via DHL,please keep an eye on it,hope you love our goods and wish to do more business with you in the future.Good luck!
C、Thank you for your patronage,if you confirm the order as soon as possible,I will send some gifts. A good news:Recently there are a lot of activities in our store.If the vakue of goods you buy count to a certain amount,we will give you a satisfied discount
D、Hello,my dear friend.Thank you for your visiting to my store,you can find the products you need from my store.If there is not what you need,you can tell us,and we can help you to find the source,please feel free to buy anything!Thanks again
注意:不改变程序的结构,不得增行或删行。
import java.awt.*;
import java.applet.*;
/*
<applet code="exl4_3.class" width=800 height=400>
</applet>
*/
public class exl4_3 extends Applet
{
private Button okBtn, clearBtn;
private String strMessage;
private TextArea tArea1, tArea2;
public void init()
{
strMessage="Hello! Welcome to the test! \n" +"Wish you good luck!";
tArea1=new TextArea(10,25);
tArea1.setText(strMessage);
tArea2=new TextArea(10,25);
tArea2.setEditable(true);
kBtn=new Button("Copy");
clearBtn=new Button("Clear");
add(tArea1);
add(tArea2);
add(okBtn);
add(clearBtn);
}
public boolean action(Event e,Object o)
{
if(e.target= =okBtn)
tArea1.setText(tArea2.getSelectedText());
else if(e.target= =clearBtn)
tArea1.setText("");
return ture;
}
}
exl4_3.html
<HTML>
<HEAD>
<TITLE>exl4_3</TITLE>
</HEAD>
<BODY>
<applet code="exl4_3.class"width=800 height=400>
</applet>
</BODY>
</HTML>
下面是一个面向连接的SOCKET实例,填入(n)处。
【说明】
代码实例中的服务器通过socket连接向客户端发送字符串"Hello,you are connected!"。只要在服务器上运行该服务器软件,在客户端运行客户软件,客户端就会收到该字符串。
客户端程序代码如下:
include<stdio.h>
include<stdlib.h>
include<errno.h>
include<string.h>
include<netdb.h>
include<sys/types.h>
include<netinet/in.h>
include<sys/socket.h>
define SERVPORT 3333
define MAXDATASIZE 100 /*每次最大数据传输量*/
main(int argc, char*argv[]){
int sockfd, recvbytes;
char buf[MAXDATASIZE];
stmct hostent*host;
struct sockaddr_in serv_addr;
if (1) {
fprintf(stderr, "Please enter the server's hostname!\n");
exit(1);
}
if<(host=gethostbyname(argv[1]))=NULL) {
herror("gethostbyname出错!");
exit(1);
}
if ((sockfd = socket(AF_INET, (2), 0))=-1) {
perror("socket创建出错!");
exit(1);
}
serv_addr.sin_family=AF_INET;
serv_addr.sin_port=htons(SERVPORT);
Serv_addr.sin_addr=*((structin_addr*)host→h_addr);
bzero(&(serv_addr.sin_zero), 8);
if(connect (3), (struct sockaddr *)&serv_addr, \
sizeof(struct sockaddr))=-1) {
perror("connect出错!");
exit(1);
}
if((recvbytes=recv (4), buf, MAXDATASIZE, 0))=-1) {
perror("recv出错!");
exit(1);
}
buf[recvbytes]='\0';
pfintf("Received: %s", buf);
close(sockfd);
}
语句”Hello”.equals(”hello”);的正确执行结果是()。
A.true
B.false
C.0
D.1
A.cout<<"1."<<setfill('')<<"Hello!"<<endl;
B.cout<<"1."<<''<<"Hello! \n";
C.cout<<"1. Hello!"<<endl;
D.cofit<<"1."<<setw(7)<<"Hello!";