为了账号安全,请及时绑定邮箱和手机立即绑定

还是错了,求助

还是错了,求助

cute倩影O_o 2016-10-20 23:21:10
 import java.util.Arrays;import java.util.Calendar;import java.util.Date;   interface Iqianqian{    void methodone(); void methodFour(); void methodTwo(); void methodThree(); void methodfour(); }public   class Helloqianqian {  public static void main(String[] args) {  Iqianqian qq= new tender();  System.out.println("功能1"+" ");  qq.methodone();  System.out.println("功能2"+" ");  qq.methodTwo();  System.out.println("功能3"+" ");  qq.methodThree();  System.out.println("功能4"+" ");  qq.methodfour();}public   class tender implements Iqianqian{ public void methodOne() {        Calendar Q = Calendar.getInstance();        Date date = Q.getTime();        Long time = Q.getTimeInMillis();        int year = Q.get(Calendar.YEAR);        int month = Q.get(Calendar.MONTH) + 1;        int day = Q.get(Calendar.DAY_OF_MONTH);        int hour = Q.get(Calendar.HOUR_OF_DAY);        int minute = Q.get(Calendar.MINUTE);        int second = Q.get(Calendar.SECOND);        System.out.println("您好北京时间;" + date);        System.out.println("小Q报时;" + year + "年" + month + "月" + day + "  " + hour + ";" + minute + ";" + second);        System.out.println("毫秒数; " + time);    }     @Override    public void methodTwo() {        String Q = " Hello lan qian is a good girl  ";        System.out.println("字符串长度:" + Q.length());        System.out.println("转换为大写:" + Q.toUpperCase());        System.out.println("子串为:" + Q.substring(6, 30));        String q1 = Q.replace("good", "beatuiful");        System.out.println("替换为:" + Q.replace("good", "beatuiful"));        System.out.println("删除字符串两边多余的空格:" + Q.trim());        System.out.println("qian的位置: " + Q.indexOf("qian"));        String[] arr = Q.split(" ");        System.out.println("把空格拆成数组 ; " + Arrays.toString(arr));        byte[] q2 = Q.getBytes();        System.out.print("转换为字节数数组: ");        for (int i = 0; i < q2.length; i++) {            System.out.print(q2[i] + " ");        }    }     @Override    public void methodThree() {        int[] Q = new int[20];        for (int i = 1; i < 20; i++) {            Q[i] = (int) (Math.random() * 100+1);            Arrays.sort(Q);            System.out.println("排序后的数;" +Q[i] + " ");        }    }     @Override    public void methodFour() {        int score = 110;        Integer englishscore = new Integer(score);        String str = "108";        int mathscore = Integer.valueOf(str);        double chinesescore = englishscore.doubleValue();        int sum = (int) (mathscore + score + chinesescore);        int averge = (sum / 3);        System.out.println("三门课总成绩;" + sum);        System.out.println("三门课平均成绩;" + averge);    }     double doubleValue() {        return 0;    }     int valueOf(String str) {        return 0 ;    } @Override public void methodone() { // TODO Auto-generated method stub } @Override public void methodfour() { // TODO Auto-generated method stub }     }}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1245 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信