Java提供的与日期相关的类和接口主要有:(该类大部分构造方法和一般方法都已经不推荐使用)、、GregorianCalendar和 DateFormat等。
查看答案
常量 Calendar.MONTH代表月份,1月-12月的值分别对应-;常量Calendar.DAY_OF_WEEK代表星期几,星期日-星期六分别对应-。
Date date=new Date();SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");String now=sdf. (date));String s=”1972-12-12”;Date date=sdf. (s);
Given:int i = (int)Math.random();What is the value of i ?Correct Answers:
A. 0
B. 1
Compilation fails.
D. any positive integer between 0 and Integer.MAX_VALUE
E. any positive integer between 0 and Integer.MAX_VALUEE: any integer between Integer.MIN_VALUE and Integer.MAX_VALUE
Given:String s = "Hello" + 9 + 1;System.out.println(s);What is the result?Correct Answers:
A. Hello91
B. Hello10
Compilation fails.
D. An exception is thrown at runtime.