Java字符类isUpperCase()方法与示例
角色類isUpperCase()方法 (Character class isUpperCase() method)
isUpperCase() method is available in java.lang package.
isUpperCase()方法在java.lang包中可用。
isUpperCase() method is used to check whether the given char value is uppercase or not.
isUpperCase()方法用于檢查給定的char值是否為大寫。
isUpperCase() method does not throw an exception at the time of checking the given char value is uppercase or not.
在檢查給定的char值是否為大寫時, isUpperCase()方法不會引發異常。
Syntax:
句法:
public boolean isUpperCase (Char value);Parameter(s):
參數:
Char value – represents the char value to be checked.
字符值 –表示要檢查的字符值。
Return value:
返回值:
The return type of this method is boolean, it returns a boolean value based on the following cases,
此方法的返回類型為boolean ,它基于以下情況返回布爾值:
It returns true, if the given char value is uppercase.
如果給定的char值為大寫,則返回true 。
It returns false, if the given char value is not in uppercase.
如果給定的char值不是大寫,則返回false 。
Example:
例:
// Java program to demonstrate the example // of boolean isUpperCase (Char value) method of Character classpublic class IsUpperCaseOfCharacterClass {public static void main(String[] args) {// It returns true because the passing // character is in UpperCase boolean result1 = Character.isUpperCase('P');// It returns false because the passing // character is not in UpperCase boolean result2 = Character.isUpperCase('p');// Display values of result1 , result2System.out.println("Character.isUpperCase('P'): " + result1);System.out.println("Character.isUpperCase('p'): " + result2);} }Output
輸出量
Character.isUpperCase('P'): true Character.isUpperCase('p'): false翻譯自: https://www.includehelp.com/java/character-class-isuppercase-method-with-example.aspx
總結
以上是生活随笔為你收集整理的Java字符类isUpperCase()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: Java ClassLoader fin
 - 下一篇: 银手链多少钱啊?