Share on Google+Share on Google+

Check for character having white space or not

This example help you find whether the char variable's value is having white space or not


This tutorial demonstrate how to check white space present in the char variable's value using isWhitespace() method.


public class IsWhiteSpace {
  public static void main(String[] args) {
    char value = ' ';
    if (Character.isWhitespace(value)) {
    else {


Download this code


Posted on: June 29, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.