import java.util.Arrays;import java.util.Calendar;import java.util.Date;public interface Iqianqian { public static void main (String[] args){ 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);} public static 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]+ " "); } } public static void methodthree(){ int[] Q=new int [20]; for(int i=1;i<20;i++) { Q[i]=(int)(Math.random()*100); Arrays.sort(Q); System.out.print(Q[i]+" ");} } public static 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); } static double doubleValue() { // TODO Auto-generated method stub return 110; } static int valueOf(String str) { // TODO Auto-generated method stub return 108; } }
添加回答
举报
0/150
提交
取消