

{"id":6677,"date":"2018-01-29T07:17:06","date_gmt":"2018-01-29T07:17:06","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=6677"},"modified":"2026-05-18T17:37:50","modified_gmt":"2026-05-18T12:07:50","slug":"java-character-class","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/java-character-class\/","title":{"rendered":"Java Character Class &#8211; 8 Astonishing Methods with Syntax &amp; Examples"},"content":{"rendered":"<p>Character class in Java has the function of wrapping a primitive type variable into a character object. However this should not be confused with the character datatype that we learned about in the previous articles. Java Character Class is a predefined class with a predefined set of methods like isLetter, isDigit etc.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78542\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg\" alt=\"Java character class\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<h3>Java Character Class<\/h3>\n<p>Character Class is a wrapper class. A wrapper class, in its simplest form, is a class that wraps(converts) a primitive datatype to an object. Why do we need to do that? Sometimes we need to change or apply different methods to a character variable. We cannot do that unless we convert the value into an immutable object. The<strong> java.util package<\/strong> handles wrapper classes.<\/p>\n<p>It is mostly useful when we want to perform various operations on characters. The real-life example of Java Character classes is that they help to validate a password for verification, such that it must have a combination of numerical values and uppercase letters. For example, the isDigit() method is useful when verifying a PIN that only has digits; if the user enters a letter, it will return false.<\/p>\n<p>Character class in Java is immutable. Once the value of a character datatype is changed to a character object, it cannot be reverted to its original form.<\/p>\n<p><strong>The basic syntax for converting a character variable to a Character object is:<\/strong><\/p>\n<p>Character &lt;variable name&gt; = new Character(&lt;value&gt;);<\/p>\n<p><strong>Example of a character class in Java:<\/strong><\/p>\n<p>Character c = new Character(\u2018z\u2019);<\/p>\n<p>This converts the character c into a Character object with the value of the argument passed as \u2018z\u2019.<\/p>\n<p><strong>Some frequently used Character Class methods used in Java are:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-Methods-used-in-Java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78543\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-Methods-used-in-Java.jpg\" alt=\"Character class methods in java\" width=\"685\" height=\"450\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-Methods-used-in-Java.jpg 685w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-Methods-used-in-Java-300x197.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-Methods-used-in-Java-150x99.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-Methods-used-in-Java-520x342.jpg 520w\" sizes=\"auto, (max-width: 685px) 100vw, 685px\" \/><\/a><\/p>\n<h3>isLetter Method in Java<\/h3>\n<p>This method returns a Boolean value, i.e., true or false. It returns true if the argument passed in the method is a letter i.e any character in between a-z and A-Z. Otherwise, it returns false.<\/p>\n<p>However, we can also include the ASCII value of the character instead of passing the character directly as an argument because Java implicitly converts all characters to their ASCII value.<\/p>\n<p><strong>Syntax of the isLetter Method in Java:<\/strong><\/p>\n<p>boolean isLetter(&lt;character&gt;);<\/p>\n<p><strong>Example program to illustrate the use of the Java isLetter method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class IsLetter {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of isLetter('a') is \" + Character.isLetter('a'));\r\n    System.out.println(\"Value of isLetter('7') is \" + Character.isLetter('7'));\r\n    System.out.println(\"The value of isLetter('97') is \" + Character.isLetter(97));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of isLetter(&#8216;a&#8217;) is true<br \/>\nValue of isLetter(&#8216;7&#8242;) is false<br \/>\nThe value of isLetter(&#8217;97&#8217;) is true<\/div>\n<p><em><strong>Note:<\/strong><\/em> Although 97 is not a letter, it is the ASCII value of \u2018a\u2019 which is a letter. Hence, it evaluates to true. Whereas the number 7 is neither a letter nor the ASCII value of a letter. Hence, it evaluates to false.<\/p>\n<h3>isDigit Method in Java<\/h3>\n<p>The isDigit method, as the name suggests, checks whether the parameter passed to it is a digit or not. It returns true if the argument passed is a digit. Otherwise, it returns false.<\/p>\n<p>This method is particularly used in situations where we need to filter data based on its numeric or character value.<\/p>\n<p><strong>Syntax of the isDigit Method in Java:<\/strong><\/p>\n<p>boolean isDigit(&lt;character&gt;);<\/p>\n<p><strong>An example program to illustrate the use of Java&#8217;s isDigit method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class IsDigit {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of isDigit('b') is \" + Character.isDigit('a'));\r\n    System.out.println(\"Value of isDigit('7') is \" + Character.isDigit('7'));\r\n    System.out.println(\"The value of isDigit('8') is \" + Character.isDigit('8'));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of isDigit(&#8216;b&#8217;) is false<br \/>\nValue of isDigit(&#8216;7&#8217;) is true<br \/>\nThe value of isDigit(\u20188\u2019) is true<\/div>\n<h3>isWhitespace Method in Java<\/h3>\n<p>Sometimes, when the value of a character is a space, we need to know that it exists in a string. Hence, we need the method of isWhitespace. It checks whether the value of the argument passed is a white space or not. However, this method also returns true if the argument is a tab or a new line.<\/p>\n<p><strong>Syntax of the isWhitespace Method in Java:<\/strong><\/p>\n<p>boolean isWhitespace(&lt;character&gt;);A<\/p>\n<p><strong>Java program to illustrate the use of the Java isWhitespace method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class IsWhitespace {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of isWhitespace(' ') is \" + Character.isWhitespace(' '));\r\n    System.out.println(\"Value of isWhitespace('\\\\n') is \" + Character.isWhitespace('\\n'));\r\n    System.out.println(\"The value of isWhitespace('\\\\t') is \" + Character.isWhitespace('\\t'));\r\n    System.out.println(\"The value of isWhitespace('b') is \" + Character.isWhitespace('b'));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of isWhitespace(&#8216; &#8216;) is true<br \/>\nValue of isWhitespace(&#8216;\\n&#8217;) is true<br \/>\nThe value of isWhitespace(&#8216;\\t&#8217;) is true<br \/>\nThe value of isWhitespace(&#8216;b&#8217;) is false<\/div>\n<h3>isUppercase Method in Java<\/h3>\n<p>This method is primarily used for checking whether the character passed in the argument is an upper-case character or not. It returns true if the character is in Uppercase. If not, it returns false.<\/p>\n<p><strong>Syntax of the isUppercase Method in Java:<\/strong><\/p>\n<p>boolean isUpperCase(&lt;character&gt;);<\/p>\n<p><strong>Java Program to illustrate the use of the Java isUpperCase method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class IsUpperCase {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of isUpperCase('a') is \" + Character.isUpperCase('a'));\r\n    System.out.println(\"Value of isUpperCase('B') is \" + Character.isUpperCase('B'));\r\n    System.out.println(\"The value of isUpperCase('c') is \" + Character.isUpperCase('c'));\r\n    System.out.println(\"The value of isUpperCase('D') is \" + Character.isUpperCase('D'));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of isUpperCase(&#8216;a&#8217;) is false<br \/>\nValue of isUpperCase(&#8216;B&#8217;) is true<br \/>\nThe value of isUpperCase(&#8216;c&#8217;) is false<br \/>\nThe value of isUpperCase(&#8216;D&#8217;) is true<\/div>\n<h3>isLowercase Method in Java<\/h3>\n<p>This method is primarily used for checking whether the character passed in the argument is a LowerCase character or not. It returns true if the character is in LowerCase. If not, it returns false.<\/p>\n<p><strong>Syntax of the isLowercase Method in Java:<\/strong><\/p>\n<p>boolean isLowerCase(&lt;character&gt;);<\/p>\n<p><strong>Java Program to illustrate the use of the isLowerCase method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class IsLowerCase {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of isLowerCase('a') is \" + Character.isLowerCase('a'));\r\n    System.out.println(\"Value of isLowerCase('B') is \" + Character.isLowerCase('B'));\r\n    System.out.println(\"The value of isLowerCase('c') is \" + Character.isLowerCase('c'));\r\n    System.out.println(\"The value of isLowerCase('D') is \" + Character.isLowerCase('D'));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of isUpperCase(&#8216;a&#8217;) is true<br \/>\nValue of isUpperCase(&#8216;B&#8217;) is false<br \/>\nThe value of isUpperCase(&#8216;c&#8217;) is true<br \/>\nThe value of isUpperCase(&#8216;D&#8217;) is false<\/div>\n<h3>toUpperCase Method in Java<\/h3>\n<p>This method, unlike all the methods we have studied until now, is a character returning method. This takes the argument and converts it into an uppercase alphabet. It returns an uppercase alphabet.<\/p>\n<p><strong>Syntax of toUpperCase Method in Java:<\/strong><\/p>\n<p>character toUpperCase(&lt;character\/ASCII value&gt;);<\/p>\n<p><strong>Program to illustrate the use of the Java toUpperCase method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class ToUpperCase {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of toUpperCase('a') is \" + Character.toUpperCase('a'));\r\n    System.out.println(\"Value of toUpperCase('B') is \" + Character.toUpperCase('B'));\r\n    System.out.println(\"The value of toUpperCase('c') is \" + Character.toUpperCase('c'));\r\n    System.out.println(\"The value of toUpperCase(112) is \" + Character.toUpperCase(112));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of toUpperCase(&#8216;a&#8217;) is A<br \/>\nValue of toUpperCase(&#8216;B&#8217;) is B<br \/>\nThe value of toUpperCase(&#8216;c&#8217;) is C<br \/>\nThe value of toUpperCase(112) is 80<\/div>\n<p><em><strong>Note:<\/strong> <\/em>When a numeric value 112, which is the ASCII value of \u2018p\u2019 is passed, it returns an ASCII value of the letter \u2018P\u2019.<\/p>\n<h3>toLowerCase Method in Java<\/h3>\n<p><strong><a href=\"https:\/\/courses.cs.washington.edu\/courses\/cse341\/98au\/java\/jdk1.2beta4\/docs\/api\/java\/lang\/String.html#toLowerCase()\" target=\"_blank\" rel=\"noopener\">Java toLowerCase method<\/a><\/strong> converts the arguments passed to it into lowercase. However, if a numeric value, i.e., the ASCII value of an UpperCase letter, is passed through, it returns the ASCII value of the corresponding lowercase alphabet.<\/p>\n<p><strong>Syntax of toLowerCase Method in Java:<\/strong><\/p>\n<p>character toLowerCase(&lt;character\/ ASCII value&gt;);<\/p>\n<p><strong>Java program to illustrate the use of the toLowerCase method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class ToLowerCase {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of toLowerCase('a') is \" + Character.toLowerCase('a'));\r\n    System.out.println(\"Value of toLowerCase('B') is \" + Character.toLowerCase('B'));\r\n    System.out.println(\"The value of toLowerCase('c') is \" + Character.toLowerCase('c'));\r\n    System.out.println(\"The value of toLowerCase(80) is \" + Character.toLowerCase(80));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of toLowerCase(&#8216;a&#8217;) is a<br \/>\nValue of toLowerCase(&#8216;B&#8217;) is b<br \/>\nThe value of toLowerCase(&#8216;c&#8217;) is c<br \/>\nThe value of toLowerCase(80) is 112<\/div>\n<p><em><strong>Note:<\/strong><\/em> The value 80 passed is actually the ASCII value of \u2018P\u2019 which, when returned as \u2018p\u2019 proves the working of the method toLowerCase.<\/p>\n<h3>toString Method in Java<\/h3>\n<p>This method has the responsibility of converting the character arguments passed through it, to String objects for manipulation as and when required by the programmer. ASCII values cannot be passed as arguments here.<\/p>\n<p><strong>Syntax of the toString Method in Java:<\/strong><\/p>\n<p>String toString(&lt;character&gt;);<\/p>\n<p><strong>Java program to illustrate the use of the toString method:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.characterclass;\r\nimport java.util. * ;\r\npublic class ToString {\r\n  public static void main(String[] args) {\r\n    System.out.println(\"The value of toString('a') is \" + Character.toString('a'));\r\n    System.out.println(\"Value of toString('B') is \" + Character.toString('B'));\r\n    System.out.println(\"The value of toString('c') is \" + Character.toString('c'));\r\n  }\r\n\r\n}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">The value of toString(&#8216;a&#8217;) is a<br \/>\nValue of toString(&#8216;B&#8217;) is B<br \/>\nThe value of toString(&#8216;c&#8217;) is c<\/div>\n<p><strong>A few more methods are :<\/strong><\/p>\n<p><strong>valueOf() Method:<\/strong> The valueOf() method of the Character class is a static method that returns a Character object for the specified character value. This can be useful for converting character literals or integers (ASCII values) to Character objects.<\/p>\n<p><strong>isAlphabetic Method:<\/strong> The isAlphabetic() method checks if the argument passed is a letter (either uppercase or lowercase). It combines the functionality of the isUpperCase() and isLowerCase() methods.<\/p>\n<h3>Escape Sequences in Java<\/h3>\n<p>There are some particular characters, which, when preceded by a backslash(\\), hold special meaning to the compiler. Some of the escape sequences are:<\/p>\n<ul>\n<li><strong>\\n:<\/strong> creates a new line<\/li>\n<li><strong>\\t:<\/strong> creates a tab space<\/li>\n<li><strong>\\b:<\/strong> inserts a single backspace<\/li>\n<li><strong>\\r:<\/strong> inserts carriage return<\/li>\n<li><strong>\\\\:<\/strong>\u00a0 inserts a backslash character<\/li>\n<li><strong>\\\u2019:<\/strong> inserts single quote character<\/li>\n<li><strong>\\\u201d:<\/strong> inserts double-quote character<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Finally we learnt that the Java Character class is one of the most important wrapper classes in Java, which is used for a lot of manipulations. We also came to know about escape sequences, which would help in the output of our code to a great extent. A clear concept of these is of utmost importance in programming.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2051,&quot;href&quot;:&quot;https:\\\/\\\/courses.cs.washington.edu\\\/courses\\\/cse341\\\/98au\\\/java\\\/jdk1.2beta4\\\/docs\\\/api\\\/java\\\/lang\\\/String.html#toLowerCase()&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20250825115132\\\/https:\\\/\\\/courses.cs.washington.edu\\\/courses\\\/cse341\\\/98au\\\/java\\\/jdk1.2beta4\\\/docs\\\/api\\\/java\\\/lang\\\/String.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-11 00:11:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-16 07:03:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-30 13:32:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-11 04:29:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-15 13:59:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-19 16:08:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-24 12:54:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-30 14:03:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-03 04:01:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-09 01:32:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-16 17:56:50&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-25 21:43:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-02 06:37:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-06 07:26:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-10 09:07:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-07 10:50:25&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-11 16:25:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-18 13:54:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-23 16:12:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-05 15:46:31&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-09 04:04:08&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-25 21:04:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 02:34:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-08 17:19:24&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-08 17:19:24&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Character class in Java has the function of wrapping a primitive type variable into a character object. However this should not be confused with the character datatype that we learned about in the previous&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":78542,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[2156,2157,2158,2159,2160,2465,2466,4191,7063,7403,14863],"class_list":["post-6677","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-boolean-is-whitespace","tag-boolean-isdigit","tag-boolean-isletter-char-ch","tag-boolean-islowercase","tag-boolean-isuppercase","tag-char-tolowercase","tag-char-touppercase","tag-escape-sequences-in-java","tag-introduction-to-java-character","tag-java-boolean-isdigitchar-ch","tag-tostringchar-ch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Character Class - 8 Astonishing Methods with Syntax &amp; Examples - DataFlair<\/title>\n<meta name=\"description\" content=\"Character class in Java has the function of wrapping a primitive type variable into a character object. Learn more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/java-character-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Character Class - 8 Astonishing Methods with Syntax &amp; Examples - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Character class in Java has the function of wrapping a primitive type variable into a character object. Learn more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/java-character-class\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-29T07:17:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-18T12:07:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Character Class - 8 Astonishing Methods with Syntax &amp; Examples - DataFlair","description":"Character class in Java has the function of wrapping a primitive type variable into a character object. Learn more.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/java-character-class\/","og_locale":"en_US","og_type":"article","og_title":"Java Character Class - 8 Astonishing Methods with Syntax &amp; Examples - DataFlair","og_description":"Character class in Java has the function of wrapping a primitive type variable into a character object. Learn more.","og_url":"https:\/\/data-flair.training\/blogs\/java-character-class\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-01-29T07:17:06+00:00","article_modified_time":"2026-05-18T12:07:50+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Java Character Class &#8211; 8 Astonishing Methods with Syntax &amp; Examples","datePublished":"2018-01-29T07:17:06+00:00","dateModified":"2026-05-18T12:07:50+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/"},"wordCount":1320,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg","keywords":["boolean is Whitespace","boolean isDigit","boolean isLetter (char ch)","boolean isLowerCase","Boolean isUpperCase","char ToLowerCase","char toUpperCase","Escape sequences in Java","Introduction to Java Character","Java boolean isDigit(char ch)","toString(char ch)"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/java-character-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/","url":"https:\/\/data-flair.training\/blogs\/java-character-class\/","name":"Java Character Class - 8 Astonishing Methods with Syntax &amp; Examples - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg","datePublished":"2018-01-29T07:17:06+00:00","dateModified":"2026-05-18T12:07:50+00:00","description":"Character class in Java has the function of wrapping a primitive type variable into a character object. Learn more.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/java-character-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Character-Class-in-java-df.jpg","width":1200,"height":628,"caption":"Java character class"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/java-character-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"Java Character Class &#8211; 8 Astonishing Methods with Syntax &amp; Examples"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/6677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=6677"}],"version-history":[{"count":15,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/6677\/revisions"}],"predecessor-version":[{"id":148370,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/6677\/revisions\/148370"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/78542"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=6677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=6677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=6677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}