java.util.Calendar 类的 getAvailableCalendarTypes() 方法返回一个 Set,其中包含 java Runtime Environment 支持的所有可用日历类型的字符串集。
用法
public static Set<String> getAvailableCalendarTypes()
参数
不接受任何值。
返回
以不可修改的 Set 形式返回所有可用的日历类型
抛出
中断异常
例子1
import java.util.Calendar;
import java.util.Set;
public class CalendargetavailablecalendartypeExample1 {
public static void main(String[] args) {
System.out.println(" All Available Calendar types:");
//method will return all available calendar types
//returnd calendar types are stored in a set.
Set set = Calendar.getAvailableCalendarTypes();
set.forEach((s) -> {
System.out.println(s);
});
}
}
输出:
All Available Calendar types: gregory buddhist Japanese
例子2
import java.util.Calendar;
import java.util.Set;
public class CalendargetavailablecalendartypeExample2 {
public static void main(String[] args) throws InterruptedException {
System.out.println(" All Available Calendar types:");
Set set = Calendar.getAvailableCalendarTypes();
for(Object s:set){
System.out.println(s);
}
}
}
输出:
All Available Calendar types: gregory buddhist japanese
例子3
import java.util.Calendar;
public class CalendargetavailablecalendartypeExample3 {
public static void main(String[] args) throws InterruptedException {
// here we are directly printing the set which is showing all available calendar type
System.out.println(Calendar.getAvailableCalendarTypes());
}
}
输出:
[gregory, buddhist, japanese]
相关用法
- Java Calendar getAvailableLocales()用法及代码示例
- Java Calendar getActualMaximum()用法及代码示例
- Java Calendar getActualMinimum()用法及代码示例
- Java Calendar get()用法及代码示例
- Java Calendar getWeekYear()用法及代码示例
- Java Calendar getDisplayName()用法及代码示例
- Java Calendar getGreatestMinimum()用法及代码示例
- Java Calendar getCalendarType()用法及代码示例
- Java Calendar getInstance()用法及代码示例
- Java Calendar getLeastMaximum()用法及代码示例
- Java Calendar getTime()用法及代码示例
- Java Calendar getMinimum()用法及代码示例
- Java Calendar getTimeInMillis()用法及代码示例
- Java Calendar getMaximum()用法及代码示例
- Java Calendar getFirstDayOfWeek()用法及代码示例
- Java Calendar getDisplayNames()用法及代码示例
- Java Calendar getTimeZone()用法及代码示例
- Java Calendar getWeeksInWeekYear()用法及代码示例
- Java Calendar getMinimalDaysInFirstWeek()用法及代码示例
- Java Calendar add()用法及代码示例
注:本文由纯净天空筛选整理自 Java Calendar getAvailableCalendarTypes() Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。