MAIN Method Just in the simple form of parameters from the command line

xiaoxiao2021-03-06  14

code show as below:

Public static void main (String [] args) {

String hostname = NULL;

String hostport = "80";

String protocol = "http";

IF (args! = null && args.length> 0) {

For (int i = 0; i

IF (args [i] .equalsignorecase ("- h")

&& args.length> = i 1) {

Hostname = args [i 1];

Else IF (args [i] .Equalsignorecase ("- t")

&& args.length> = i 1) {

Protocol = args [i 1];

Else IF (args [i] .Equalsignorecase ("- p")

&& args.Length> = i 1)

Hostport = args [i 1];

}

}

}

转载请注明原文地址:https://www.9cbs.com/read-49663.html

New Post(0)