for (int i = 0; i for (int i = 0; i try Socket socket = new Socket(argsi,

Xuất bản: 03/11/2020 - Cập nhật: 29/08/2023 - Tác giả: Hà Anh

Câu Hỏi:

for (int i = 0; i < args.length; i++) {
for (int i = 0; i < args.length; i++) {
try {
Socket socket = new Socket(args[i], 80);
System.out.print("Connected to " + socket.getInetAddress());
System.out.print(" on port " + socket.getPort());
System.out.print(" from port " + socket.getLocalPort());
System.out.println(" of " + socket.getLocalAddress());
} catch(UnknownHostException e) {
e.printStackTrace();
} catch(SocketException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}

Chương trình sau thực hiện công việc gì?

Đáp án và lời giải

đáp án đúng: D

Hà Anh (Tổng hợp)

đề trắc nghiệm lập trình Test mới nhất

X