Notice: Constant WP_MEMORY_LIMIT already defined in /home/javawith/public_html/codesjava.com/wp-config.php on line 107

Notice: Constant WP_MAX_MEMORY_LIMIT already defined in /home/javawith/public_html/codesjava.com/wp-config.php on line 108
Char data type in java - CodesJava

CodesJava

Easy learning with example program codes

Char Data Type in Java


Notice: Undefined variable: footnotelist in /home/javawith/public_html/codesjava.com/wp-content/plugins/latex2html/inc/core.php on line 475

 
The char data type represents a single 16-bit Unicode character. It has a minimum value of ‘\u0000’ (or 0) and a maximum value of ‘\uffff’ (or 65,535 inclusive).

Program to declare and use Java primitive char variable.

/**
 * Program to declare and use Java primitive char variable.
 * @author CodesJava
 */
public class DataTypeCharExample {	
  public static void main(String args[]){ 
	//Declare char type variables.
	char ch1 = 'A';
        char ch2 = 66;
 
        //Print variables value.
        System.out.println("ch1 Value :" + ch1);
        System.out.println("ch2 Value :" + ch2);
  }
}

Output:

ch1 Value :A
ch2 Value :B

 

Please follow and like us:
error
Posted in Java   

Core Java Tutorial








Copyright © 2019 CodesJava DMCA.com Protection Status