题解 | #HTTP状态码#

HTTP状态码

http://www.nowcoder.com/practice/99dba043761e43c2a6f931e2c5c247c7

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(sc.hasNextInt())
        {
            int num = sc.nextInt();
            switch(num) {
                case 200:System.out.println("OK");break;
                case 202:System.out.println("Accepted");break;
                case 400:System.out.println("Bad Request");break;
                case 403:System.out.println("Forbidden");break;
                case 404:System.out.println("Not Found");break;
                case 500:System.out.println("Internal Server Error");break;
                case 502:System.out.println("Bad Gateway");break;
        }
         
    }
}
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务