题解 | #HTTP状态码#
HTTP状态码
http://www.nowcoder.com/practice/99dba043761e43c2a6f931e2c5c247c7
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while(scan.hasNextInt()) {
int n = scan.nextInt();
if(n == 200) {
System.out.println("OK");
} else if(n == 202) {
System.out.println("Accepted");
} else if(n == 400) {
System.out.println("Bad Request");
} else if(n == 403) {
System.out.println("Forbidden");
} else if(n == 404) {
System.out.println("Not Found");
} else if(n == 500) {
System.out.println("Internal Server Error");
} else if(n == 502) {
System.out.println("Bad Gateway");
}
}
}
}
Java基础练习题 文章被收录于专栏
都是一些基础的语法题目,每天可以刷几道。