xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create different data type variables in Java
Java Online Editor
Execute Code
More Java Sample Codes
public class ExampleApp { public static void main(String[] args) { // Declare and initialize variables of different data types char charVariable = 'A'; // Character data System.out.println(charVariable + " is a character data"); // output: A is a character data String stringVariable = "Hello Java"; // String data System.out.println(stringVariable + " is a string data"); // output: Hello Java is a string data int integerVariable = 10; // Integer data System.out.println(integerVariable + " is an integer data"); // output: 10 is an integer data float floatVariable = 3.14f; // Single-precision floating-point data System.out.println(floatVariable + " is a float data"); // output: 3.14 is a float data double doubleVariable = 2.71828; // Double-precision floating-point data System.out.println(doubleVariable + " is a double data"); // output: 2.71828 is a double data boolean boolVariable = true; // Boolean data System.out.println(boolVariable + " is a boolean data"); // output: true is a boolean data } }