學(xué)習(xí)Java中的日期和時(shí)間處理及Java日歷小程序的編寫
Java 在 java.util 包中提供了 Date 類,這個(gè)類封裝了當(dāng)前的日期和時(shí)間。
Date 類支持兩種構(gòu)造函數(shù)。第一個(gè)構(gòu)造函數(shù)初始化對(duì)象的當(dāng)前日期和時(shí)間。
Date( )
下面的構(gòu)造函數(shù)接收一個(gè)參數(shù)等于自1970年1月1日午夜起已經(jīng)過的毫秒數(shù)
Date(long millisec)
一旦有一個(gè)可用的日期對(duì)象,可以調(diào)用以下任何一種支持的方法使用時(shí)間:
| SN | 方法和描述 |
|---|---|
| 1 | boolean after(Date date) 如果調(diào)用Date對(duì)象包含或晚于指定的日期則返回true,否則,返回false。 |
| 2 | boolean before(Date date) 如果調(diào)用Date對(duì)象包含或早于日期指定的日期返回true,否則,返回false。 |
| 3 | Object clone( ) 重復(fù)調(diào)用Date對(duì)象。 |
| 4 | int compareTo(Date date) 調(diào)用對(duì)象的值與日期比較。如果這兩個(gè)值相等返回0。如果調(diào)用對(duì)象是早于日期返回一個(gè)負(fù)值。如果調(diào)用對(duì)象遲于日期返回正值。 |
| 5 | int compareTo(Object obj) 以相同的compareTo(Date)操作 如果obj是一個(gè)類日期。否則,它會(huì)拋出一個(gè)ClassCastException。 |
| 6 | boolean equals(Object date) 如果調(diào)用Date對(duì)象包含相同的時(shí)間及日期指定日期則返回true,否則,返回false。 |
| 7 | long getTime( ) 返回自1970年1月1日起已經(jīng)過的毫秒數(shù)。 |
| 8 | int hashCode( ) 返回調(diào)用對(duì)象的哈希代碼。 |
| 9 | void setTime(long time) 設(shè)置所指定的時(shí)間,這表示從1970年1月1日從午夜的時(shí)間和日期以毫秒為單位經(jīng)過的時(shí)間。 |
| 10 | String toString( ) 調(diào)用Date對(duì)象轉(zhuǎn)換為字符串,并返回結(jié)果。 |
獲取當(dāng)前日期和時(shí)間
在 Java 中容易得到當(dāng)前的日期和時(shí)間??梢允褂靡粋€(gè)簡單的 Date 對(duì)象的 toString() 方法,如下所示打印當(dāng)前日期和時(shí)間:
import java.util.Date;
public class DateDemo {
public static void main(String args[]) {
// Instantiate a Date object
Date date = new Date();
// display time and date using toString()
System.out.println(date.toString());
}
}
這將產(chǎn)生以下結(jié)果:
Mon May 04 09:51:52 CDT 2009
日期比較
有以下三種方式來比較兩個(gè)日期:
- 可以使用 getTime() 來獲得自1970年1月1日午夜十二時(shí)起已經(jīng)過的毫秒數(shù),然后比較兩個(gè)對(duì)象的值。
- 可以使用 before( ), after( ), 和 equals( ) 方法,由于12日在18日前,例如, new Date(99, 2, 12).before(new Date (99, 2, 18)) 返回值為 true。
- 可以使用 compareTo() 方法,這是由 Comparable 接口定義,由 Date 實(shí)現(xiàn)。
使用 SimpleDateFormat 格式化日期
SimpleDateFormat 是一個(gè)具體的類,以本地方式用于格式化和轉(zhuǎn)換日期。SimpleDateFormat 允許選擇用戶定義的模式為日期時(shí)間格式。例如:
import java.util.*;
import java.text.*;
public class DateDemo {
public static void main(String args[]) {
Date dNow = new Date( );
SimpleDateFormat ft =
new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
System.out.println("Current Date: " + ft.format(dNow));
}
}
這將產(chǎn)生以下結(jié)果:
Current Date: Sun 2004.07.18 at 04:14:09 PM PDT
簡單的 DateFormat 格式代碼
要指定時(shí)間格式,使用時(shí)間模式字符串。在這個(gè)模式中,所有的 ASCII 字母被保留為模式字母,其定義如下:
| 字符 | 描述 | 例子 |
|---|---|---|
| G | 時(shí)代指示器 | AD |
| y | 四位數(shù)年份 | 2001 |
| M | 年中的月份 | July or 07 |
| d | 月份中日期 | 10 |
| h | 時(shí)間 A.M./P.M.(1~12) | 12 |
| H | 天中的小時(shí) (0~23) | 22 |
| m | 小時(shí)中的分鐘 | 30 |
| s | 分鐘中的秒鐘 | 55 |
| S | 毫秒 | 234 |
| E | 星期中的天 | Tuesday |
| D | 年中的天 | 360 |
| F | 月中星期中的天 | 2 (second Wed. in July) |
| w | 年中的星期 | 40 |
| W | 月中的星期 | 1 |
| a | A.M./P.M. 標(biāo)記 | PM |
| k | 天中的小時(shí)(1~24) | 24 |
| K | 小時(shí)A.M./P.M. (0~11) | 10 |
| z | 時(shí)區(qū) | 東部標(biāo)準(zhǔn)時(shí)間 |
| ' | 脫離文本 | 分隔符 |
| " | 單引號(hào) | ` |
用 printf 格式化日期
日期和時(shí)間格式用 printf 方法可以非常輕松地做到??梢允褂脙蓚€(gè)字母的格式,從 t 開始并在下面給出的表格中的其中一個(gè)字母結(jié)束。例如:
import java.util.Date;
public class DateDemo {
public static void main(String args[]) {
// Instantiate a Date object
Date date = new Date();
// display time and date using toString()
String str = String.format("Current Date/Time : %tc", date );
System.out.printf(str);
}
}
這將產(chǎn)生以下結(jié)果:
Current Date/Time : Sat Dec 15 16:37:57 MST 2012
如果提供日期多次格式化是一種不好的做法。一個(gè)格式字符串可以指示要格式化的參數(shù)的索引。
索引必須緊跟在 % 之后,并必須由 $ 終止。例如:
import java.util.Date;
public class DateDemo {
public static void main(String args[]) {
// Instantiate a Date object
Date date = new Date();
// display time and date using toString()
System.out.printf("%1$s %2$tB %2$td, %2$tY",
"Due date:", date);
}
}
這將產(chǎn)生以下結(jié)果:
Due date: February 09, 2004
或者,也可以使用 < 標(biāo)志。則表示相同的參數(shù),根據(jù)前述格式規(guī)范,應(yīng)再次使用。例如:
import java.util.Date;
public class DateDemo {
public static void main(String args[]) {
// Instantiate a Date object
Date date = new Date();
// display formatted date
System.out.printf("%s %tB %<te, %<tY",
"Due date:", date);
}
}
這將產(chǎn)生以下結(jié)果:
Due date: February 09, 2004
日期和時(shí)間轉(zhuǎn)換字符
| 字符 | 描述 | 例子 |
|---|---|---|
| c | 完整的日期和時(shí)間 | Mon May 04 09:51:52 CDT 2009 |
| F | ISO 8601 日期 | 2004-02-09 |
| D | U.S. 格式時(shí)間 (月/日/年) | 02/09/2004 |
| T | 24-時(shí)制 | 18:05:19 |
| r | 12-時(shí)制 | 06:05:19 pm |
| R | 24-時(shí)制,無秒 | 18:05 |
| Y | 四位數(shù)年份 (用前行零列) | 2004 |
| y | 年份的后兩位數(shù)(用前行零列) | 04 |
| C | 年份的前兩位(用前行零列) | 20 |
| B | 完整月份名稱 | February |
| b | 縮寫月份名稱 | Feb |
| m | 兩位數(shù)月份 (用前行零列) | 02 |
| d | 兩位數(shù)日期 (用前行零列) | 03 |
| e | 兩位數(shù)日期(無前行零列) | 9 |
| A | 完整星期名稱 | Monday |
| a | 縮寫星期名稱 | Mon |
| j | 年中的三位數(shù)天數(shù)(用前行零列) | 069 |
| H | 兩位數(shù)小時(shí)(用前行零列), 00 和 23之間 | 18 |
| k | 兩位數(shù)小時(shí)(無前行零列), 0 和 23 之間 | 18 |
| I | 兩位數(shù)小時(shí) (用前行零列), 01和12之間 | 06 |
| l | 兩位數(shù)小時(shí) (無前行零列), 1 和12之間 | 6 |
| M | 兩位數(shù)分鐘 (用前行零列) | 05 |
| S | 兩位數(shù)秒鐘(用前行零列) | 19 |
| L | 三位數(shù)毫秒(用前行零列) | 047 |
| N | 九位數(shù)納秒 (用前行零列) | 047000000 |
| P | 大寫上下午標(biāo)記 | PM |
| p | 小寫上下午標(biāo)記 | pm |
| z | RFC 822 從GMT數(shù)字抵消 | -0800 |
| Z | 時(shí)區(qū) | PST |
| s | 從 1970-01-01 00:00:00 的秒數(shù)GMT | 1078884319 |
| Q | 從 1970-01-01 00:00:00 的毫秒數(shù)GMT | 1078884319047 |
有相關(guān)的日期和時(shí)間等有用的類。欲了解更多詳細(xì)信息,可以參考 Java 標(biāo)準(zhǔn)文檔。
字符串轉(zhuǎn)換日期
SimpleDateFormat 類有一些額外的方法,如 parse(),它試圖根據(jù)存儲(chǔ)在給定 SimpleDateFormat 的對(duì)象的格式來轉(zhuǎn)換字符串。例如:
import java.util.*;
import java.text.*;
public class DateDemo {
public static void main(String args[]) {
SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd");
String input = args.length == 0 ? "1818-11-11" : args[0];
System.out.print(input + " Parses as ");
Date t;
try {
t = ft.parse(input);
System.out.println(t);
} catch (ParseException e) {
System.out.println("Unparseable using " + ft);
}
}
}
上述程序的運(yùn)行示例將產(chǎn)生以下結(jié)果:
$ java DateDemo 1818-11-11 Parses as Wed Nov 11 00:00:00 GMT 1818 $ java DateDemo 2007-12-01 2007-12-01 Parses as Sat Dec 01 00:00:00 GMT 2007
休眠一段時(shí)間
你可以進(jìn)行任何期間的時(shí)間休眠,從一毫秒直到你的電腦的整個(gè)生命周期。例如,下面的程序會(huì)休眠10秒:
import java.util.*;
public class SleepDemo {
public static void main(String args[]) {
try {
System.out.println(new Date( ) + "\n");
Thread.sleep(5*60*10);
System.out.println(new Date( ) + "\n");
} catch (Exception e) {
System.out.println("Got an exception!");
}
}
}
這將產(chǎn)生以下結(jié)果:
Sun May 03 18:04:41 GMT 2009 Sun May 03 18:04:51 GMT 2009
測(cè)量執(zhí)行時(shí)間
有時(shí)候,可能需要測(cè)量的時(shí)間點(diǎn)以毫秒為單位。因此,讓我們?cè)僖淮沃匦聦懮厦娴睦?
import java.util.*;
public class DiffDemo {
public static void main(String args[]) {
try {
long start = System.currentTimeMillis( );
System.out.println(new Date( ) + "\n");
Thread.sleep(5*60*10);
System.out.println(new Date( ) + "\n");
long end = System.currentTimeMillis( );
long diff = end - start;
System.out.println("Difference is : " + diff);
} catch (Exception e) {
System.out.println("Got an exception!");
}
}
}
這將產(chǎn)生以下結(jié)果:
Sun May 03 18:16:51 GMT 2009 Sun May 03 18:16:57 GMT 2009 Difference is : 5993
GregorianCalendar 類
GregorianCalendar 是一個(gè) Calendar 類具體的實(shí)現(xiàn),即你所熟悉的對(duì)正常 Gregorian 公歷的實(shí)現(xiàn)。本教程中不討論 Calendar 類,可以看看標(biāo)準(zhǔn) Java 文檔。
Calendar 的 getInstance() 方法返回與當(dāng)前日期和時(shí)間默認(rèn)語言環(huán)境和時(shí)區(qū)初始化的一個(gè) GregorianCalendar。 GregorianCalendar 中定義了兩個(gè)字段:AD 和 BC。這些代表在公歷中定義的兩個(gè)時(shí)代。
也有幾個(gè)構(gòu)造函數(shù)的 GregorianCalendar 對(duì)象:
| SN | 構(gòu)造函數(shù)描述 |
|---|---|
| 1 | GregorianCalendar() 在默認(rèn)時(shí)區(qū)與默認(rèn)語言環(huán)境使用當(dāng)前時(shí)間構(gòu)造默認(rèn)的GregorianCalendar。 |
| 2 | GregorianCalendar(int year, int month, int date) 在默認(rèn)時(shí)區(qū)設(shè)置默認(rèn)的語言環(huán)境用給定的日期構(gòu)造一個(gè)GregorianCalendar |
| 3 | GregorianCalendar(int year, int month, int date, int hour, int minute) 用給定的日期和時(shí)間設(shè)置為與默認(rèn)語言環(huán)境的默認(rèn)時(shí)區(qū)構(gòu)造一個(gè)GregorianCalendar。 |
| 4 | GregorianCalendar(int year, int month, int date, int hour, int minute, int second) 用給定的日期和時(shí)間設(shè)置為與默認(rèn)語言環(huán)境的默認(rèn)時(shí)區(qū)構(gòu)造一個(gè) GregorianCalendar |
| 5 | GregorianCalendar(Locale aLocale) 基于當(dāng)前時(shí)間與給定語言環(huán)境的默認(rèn)時(shí)區(qū)構(gòu)建一個(gè)GregorianCalendar。 |
| 6 | GregorianCalendar(TimeZone zone) 基于當(dāng)前時(shí)間,使用默認(rèn)的語言環(huán)境在給定的時(shí)區(qū)構(gòu)建一個(gè)GregorianCalendar。 |
| 7 | GregorianCalendar(TimeZone zone, Locale aLocale) 基于當(dāng)前時(shí)間與給定語言環(huán)境的給定時(shí)區(qū)構(gòu)建一個(gè)GregorianCalendar。 |
這里是由 GregorianCalendar 類提供的一些有用的方法的列表:
| SN | 方法和描述 |
|---|---|
| 1 | void add(int field, int amount) 基于日歷的規(guī)則,以給定的時(shí)間字段添加指定(有符號(hào)的)時(shí)間量。 |
| 2 | protected void computeFields() 將UTC轉(zhuǎn)換為毫秒時(shí)間字段值. |
| 3 | protected void computeTime() 覆蓋日歷轉(zhuǎn)換時(shí)間域值為UTC的毫秒. |
| 4 | boolean equals(Object obj) 這個(gè)GregorianCalendar與一個(gè)對(duì)象引用比較. |
| 5 | int get(int field) 獲取給定時(shí)間域的值. |
| 6 | int getActualMaximum(int field) 返回該字段可能的最大值,給定到當(dāng)前的日期. |
| 7 | int getActualMinimum(int field) 返回該字段可能具有的最小值,給定當(dāng)前的日期. |
| 8 | int getGreatestMinimum(int field) 對(duì)于給定的字段中返回高最低值(如果有變化). |
| 9 | Date getGregorianChange() 獲取公歷更改日期. |
| 10 | int getLeastMaximum(int field) 對(duì)于給定的字段返回最低的最大值,如果有變化. |
| 11 | int getMaximum(int field) 返回給定字段中的最大值. |
| 12 | Date getTime() 獲取日歷的當(dāng)前時(shí)間. |
| 13 | long getTimeInMillis() 獲取日歷的當(dāng)前時(shí)間長. |
| 14 | TimeZone getTimeZone() 獲取時(shí)區(qū). |
| 15 | int getMinimum(int field) 返回給定字段中的最小值. |
| 16 | int hashCode() 重寫hashCode. |
| 17 | boolean isLeapYear(int year) 確定給定年份是閏年. |
| 18 | void roll(int field, boolean up) 加上或減去(上/下)的時(shí)間在給定的時(shí)間字段一個(gè)單元,不更改更大的字段. |
| 19 | void set(int field, int value) 設(shè)置時(shí)間字段與給定值. |
| 20 | void set(int year, int month, int date) 設(shè)置為年,月,日的值. |
| 21 | void set(int year, int month, int date, int hour, int minute) 設(shè)置為年,月,日,小時(shí)和分鐘值. |
| 22 | void set(int year, int month, int date, int hour, int minute, int second) 設(shè)置為字段的年,月,日,小時(shí),分鐘和秒的值. |
| 23 | void setGregorianChange(Date date) 設(shè)置GregorianCalendar更改日期. |
| 24 | void setTime(Date date) 設(shè)置日歷的當(dāng)前時(shí)間與給定日期. |
| 25 | void setTimeInMillis(long millis) 從給定long值設(shè)置日歷的當(dāng)前時(shí)間. |
| 26 | void setTimeZone(TimeZone value) 將時(shí)區(qū)設(shè)置與給定的時(shí)區(qū)值. |
| 27 | String toString() 返回此日歷的字符串表示形式. |
示例
import java.util.*;
public class GregorianCalendarDemo {
public static void main(String args[]) {
String months[] = {
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"};
int year;
// Create a Gregorian calendar initialized
// with the current date and time in the
// default locale and timezone.
GregorianCalendar gcalendar = new GregorianCalendar();
// Display current time and date information.
System.out.print("Date: ");
System.out.print(months[gcalendar.get(Calendar.MONTH)]);
System.out.print(" " + gcalendar.get(Calendar.DATE) + " ");
System.out.println(year = gcalendar.get(Calendar.YEAR));
System.out.print("Time: ");
System.out.print(gcalendar.get(Calendar.HOUR) + ":");
System.out.print(gcalendar.get(Calendar.MINUTE) + ":");
System.out.println(gcalendar.get(Calendar.SECOND));
// Test if the current year is a leap year
if(gcalendar.isLeapYear(year)) {
System.out.println("The current year is a leap year");
}
else {
System.out.println("The current year is not a leap year");
}
}
}
這將產(chǎn)生以下結(jié)果:
Date: Apr 22 2009 Time: 11:25:27 The current year is not a leap year
日歷小程序
下面我們來看一個(gè)日歷小程序。這里用傳統(tǒng)的MVC結(jié)構(gòu),設(shè)計(jì)3個(gè)類:CalendarViewer、CalendarControlller、CalendarModel。
CalendarViewer.java主要處理UI,沿用了已有代碼,整理之并抽出業(yè)務(wù)邏輯,使其專注于顯示層處理。
CalendarViewer.java
public class CalendarViewer extends JWindow implements ActionListener {
JPanel calendarYmPanel = null;
JButton leftButton = new JButton("<<");
JButton rightButton = new JButton(">>");
Label yearLabel = new Label();
Label monthLabel = new Label();
Label passedDaysLabel = new Label();
JPanel calendarWdPanel = null;// 是caledar_week和calendar_days的總包容體
JPanel calendarWeekPanel = null;// 針對(duì)周列的布局
JPanel calendarDaysPanel = null;// 針對(duì)日期列的布局
JPanel calendarExitPanel = null;
JButton quitButton = new JButton("關(guān)閉");
Border emptyBorder = BorderFactory.createEmptyBorder();
CalendarController cController = new CalendarController();
public CalendarViewer() {
super();
buildUI();
}
public void buildUI() {
buildTopPanel();
buildCenterPanel();
buildBottomPanel();
setLayout(new BorderLayout());
。。。。。。
}
private void buildTopPanel() {。。。。。。}
private void buildCenterPanel() {。。。。。。}
private void buildBottomPanel() {。。。。。。}
public JPanel updateDaysPanel() {。。。。。。}
public void updatePassedDaysLabel() {。。。。。。}
public void actionPerformed(ActionEvent e) {。。。。。。}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new CalendarViewer();
}
});
}
}

UI構(gòu)造主要分3塊,對(duì)應(yīng)圖上中下3個(gè)panel。
- buildTopPanel();
- buildCenterPanel();
- buildBottomPanel();
事件監(jiān)聽的處理由下面方法完成。
- actionPerformed(ActionEvent e);
基于事件的UI更新由以下兩個(gè)方法完成。
updateDaysPanel();
updatePassedDaysLabel();
CalendarController.java主要處理具體的業(yè)務(wù)邏輯,而所使用的一些與具體應(yīng)用無關(guān)的日歷算法邏輯則交給CalendarModel.java。
CalendarModel.java
public class CalendarModel {
private int daytab[][] = {
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } };
public boolean isLeapYear(int year) {
return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}
public int dayOfYear(int day, int month, int year) {
int leap = isLeapYear(year) ? 1 : 0;
for (int i = 1; i < month; i++)
day += daytab[leap][i];
return day;
}
public int daysOfMonth(int month, int year) {
int leap = isLeapYear(year) ? 1 : 0;
return daytab[leap][month];
}
public int dayOfWeek(int day, int month, int year) {
if (month == 1) {
month = 13;
year--;
}
if (month == 2) {
month = 14;
year--;
}
return (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year
/ 100 + year / 400) % 7 + 1;
}
}
建立一個(gè)二維數(shù)組,分別表示閏年與非閏年的每月天數(shù)。主要方法有:
- boolean isLeapYear(int year);判斷閏年
- dayOfYear(int day, int month, int year);計(jì)算所提供日期為當(dāng)前year的第幾天
- daysOfMonth(int month, int year);返回當(dāng)前月份的天數(shù)
- dayOfWeek(int day, int month, int year); 計(jì)算某年某月某日是星期幾,這里使用了基姆拉爾森計(jì)算公式。
基姆拉爾森計(jì)算公式
- W= (d+2*m+3*(m+1)/5+y+y/4-y/100+y/400) mod 7
- d 天
- m 月
- y 年
- 1月2月?lián)Q算為去年的13 14月計(jì)算
- w=0是星期一,依次類推。
相關(guān)文章
Mybatis-plus 雙主鍵的實(shí)現(xiàn)示例
本文主要介紹了Mybatis-plus 雙主鍵的實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2024-05-05
Java多線程編程之使用Exchanger數(shù)據(jù)交換實(shí)例
這篇文章主要介紹了Java多線程編程之使用Exchanger數(shù)據(jù)交換實(shí)例,本文直接給出實(shí)例代碼,需要的朋友可以參考下2015-05-05
Java實(shí)現(xiàn)獲取某年某月第一天/最后一天的方法
這篇文章主要介紹了Java實(shí)現(xiàn)獲取某年某月第一天/最后一天的方法,涉及java日期運(yùn)算相關(guān)操作技巧,需要的朋友可以參考下2018-02-02
JVM內(nèi)存區(qū)域劃分相關(guān)原理詳解
這篇文章主要介紹了JVM內(nèi)存區(qū)域劃分相關(guān)原理詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-10-10
詳解Springboot2.3集成Spring security 框架(原生集成)
這篇文章主要介紹了詳解Springboot2.3集成Spring security 框架(原生集成),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-08-08
解決IDEA鼠標(biāo)點(diǎn)擊光標(biāo)變大問題
這篇文章主要介紹了解決IDEA鼠標(biāo)點(diǎn)擊光標(biāo)變大問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2021-02-02
Intellij IDEA如何自定義注釋模板的實(shí)現(xiàn)方法
這篇文章主要介紹了Intellij IDEA如何自定義注釋模板的實(shí)現(xiàn)方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-05-05

