调用此方法,并且应该将时间输出到void msgOut(String s)
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
String uhrzeit = sdf.format(new Date());
msgOut("[System] Zeit: "+uhrzeit);
txtSName.setText("");
txtSName.requestFocus();
}
但每次都会返回错误:
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at sun.util.calendar.ZoneInfo.getOffsets(ZoneInfo.java:236)
at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2340)
at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2312)
at java.util.Calendar.setTimeInMillis(Calendar.java:1804)
at java.util.Calendar$Builder.build(Calendar.java:1508)
at sun.util.locale.provider.CalendarProviderImpl.getInstance(CalendarProviderImpl.java:88)
at java.util.Calendar.createCalendar(Calendar.java:1666)
at java.util.Calendar.getInstance(Calendar.java:1655)
at java.text.SimpleDateFormat.initializeCalendar(SimpleDateFormat.java:657)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:601)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:580)
at Server.befTime(Server.java:261)
(行SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
是行号261并返回错误...
有人可以帮帮我吗?
添加:相同 - &gt; SAME(复制和粘贴)方法在另一个类中工作,没有任何错误...