User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:datatypes

Declaration Dataypes

 
package datatypes;
 
public class DataTypes {
 
    public static void main(String[] args) {
        // primitiv Datatypes
 
        boolean aa = true;     // 1 bit
        char bb = 'A';         // 2 Bytes
        char cc = 65;          // 2 Bytes
        byte dd = 12;          // 1 Byte -128 - +127
        short ee = 234;        // 2 Bytes -32768 - +32767
        int ff = 4711;         // 4 Bytes
        long gg = 34567;       // 8 Bytes
        float hh = 3.14f;      // 4 Bytes
        double ii = 3.14;      // 8 Bytes
 
        // complex Datatypes
        String str = "Today is Monday";
        int[] arr = {11, 22, 33, 44, 55, 66, 77}; // Int Array
        int[][] arr2 = {                          // Multidimensional Int Array with init
                        {11, 22, 33},
                        {44, 55, 66, 77}
        };
 
        int[][] mu = new int[3][4];             // Multidimensional Int Array 
 
        String[] strArr = new String[5];
 
        System.out.println(cc);
    }
}

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
java/datatypes.txt · Last modified: 2024/02/16 00:48 (external edit)

Impressum Datenschutz