java.util.logging.Level的getResourceBundleName()方法用於獲取此級別對象的本地化資源包名稱。如果存在本地化包,則此方法返回包的名稱,否則返回null。
用法:
public String getResourceBundleName()
參數:此方法不接受任何內容。
返回:此方法返回本地化資源包名稱。
以下示例程序旨在說明getResourceBundleName()方法:
示例1:
// Java program to illustrate
// getResourceBundleName() method
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
public class GFG {
public static void main(String[] args)
{
// Create a Logger
Logger logger
= Logger.getLogger(
Object.class.getName())
.getParent();
// Get level of logger
Level level
= logger.getLevel();
// get localization resource bundle name
String name = level.getResourceBundleName();
// print level localization resource bundle name
System.out.println("Localization resource"
+ " bundle name = "
+ name);
}
}
輸出:
Localization resource bundle name = sun.util.logging.resources.logging
示例2:
// Java program to illustrate
// getResourceBundleName() method
import java.util.logging.Level;
public class GFG {
public static void main(String[] args)
{
// Get level of logger
Level level
= Level.parse("SEVERE");
// get localization resource bundle name
String name = level.getResourceBundleName();
// print level localization resource bundle name
System.out.println("Localization resource"
+ " bundle name = "
+ name);
}
}
輸出:
Localization resource bundle name = sun.util.logging.resources.logging
參考文獻: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Level.html#getResourceBundleName()
相關用法
- Java LogRecord getResourceBundleName()用法及代碼示例
- Java Logger getResourceBundleName()用法及代碼示例
- Java Level getLocalizedName()用法及代碼示例
- Java Level toString()用法及代碼示例
- Java Level getName()用法及代碼示例
- Java Level equals()用法及代碼示例
- Java Level intValue()用法及代碼示例
- Java Level parse()用法及代碼示例
- Java Level hashCode()用法及代碼示例
- Java Java.util.Collections.rotate()用法及代碼示例
- Java Java lang.Long.numberOfLeadingZeros()用法及代碼示例
- Java Java lang.Long.numberOfTrailingZeros()用法及代碼示例
- Java Java lang.Long.lowestOneBit()用法及代碼示例
注:本文由純淨天空篩選整理自AmanSingh2210大神的英文原創作品 Level getResourceBundleName() method in Java with Examples。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。