已采纳回答 / Batsy
Calendar不能用new的方式去实例化,你可以看一下这个类的源码:/** * Constructs a new instance of the {@code Calendar} subclass appropriate for the * default {@code Locale} and default {@code TimeZone}, set to the current date and time. */ public static synchronized C...
2016-07-23
已采纳回答 / 慕仰6620973
String temp = "哇哈哈"; System.out.println(temp+"1234"); // 两个空间,分别是temp和temp+"1234" StringBuilder sb = new StringBuilder("哇哈哈"); System.out.println(sb.append("1234")); // 一个空间
2016-07-23
最新回答 / 霜之咏叹颂
public class test_1 { public static void main(String[] args) { test_1 result = new test_1(); result.deal2(); } public class DIYException1 extends Exception { public DIYException1() { } } public class DIYException...
2016-07-23
最赞回答 / 慕瓜8446161
Calendar calendar = Calendar.getInstance();Date date = calendar.getTime();//获取当前的时间int dayOfWeek = calendar.get(Calendar.DAY_OF-WEEK);//当前天位于当前周的第几天(按照西方习惯)if(dayOfWeek==1){System.out.println("今天是周日!")//西方人以周日为第一天}else{System.out.println("今天是周"+dayOfWeek-...
2016-07-23
最新回答 / 天辰
Calendar c = Calendar.getInstance();Date date=c.getTimeSimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String now=sdf.format(date)System.out.println("北京时间”+now);}}
2016-07-23
已采纳回答 / 慕粉18817939419
单个的字符用单引号,字符串用双引号。获取的index是'.'(点)号所在位置,加1的话就是'.'(点)号后面一个位置,substring(开始位置,结束位置)获取的是从开始位置(包括开始位置)到结束位置(不包括结束位置)的字符串,通过这个方法来获取后缀名。 ps:其实可以直接用index,也没影响,只是后缀名前面多加一个点号。可以,但是和String prefix= fileName. substring(index+1,fileName.length())这个结果不一样,这个不包括点号(因为inde...
2016-07-23
已采纳回答 / 葫芦娃3250413
//获取文件名中最后一次出现"."号的位置int index = FILEName.lastIndexOf(".");FILEName 应该是 fileName 吧,你试试看~
2016-07-23
已采纳回答 / qq_梦中虔诚_03693510
List<String>就是只能存入String类型的对象,List<Integer>就是只能存入Integer类型的对象,通过<指定类型>对泛型进行指定
2016-07-22
已采纳回答 / JustWannaHugU
父类指的是Exception类,因为是自带的方法,老师没有说。同学,你可以按住ctrl键,点击Exception,然后就能看到它的源代码了
2016-07-22