笔试题目积累

1:接口可以被哪一些修饰符修饰?

答案:interface only public & abstract are permitted、

2:输出下面的答案!

public class StringLength {

    public static void main(String[] args) throws Exception {
        String str = "我是大鑫";
        System.out.println(str.length());//4
        System.out.println(str.getBytes("utf8").length);//12
        System.out.println(str.getBytes("gbk").length);//8
        System.out.println(str.getBytes("unicode").length);//10

    }

}

 

posted @ 2017-09-11 21:30  bf378  阅读(112)  评论(0编辑  收藏  举报