How to learn a programming languages

Step 1 : Data types, Variables, Constants, Identifiers, Literals

Step 2: Operators , Expression

Step 3: Statements


A variable and a constant are temporary storage locations in RAM. The key difference between them is that a variable's value can be changed, while a constant's value remains fixed.

Variables and constants are stored in RAM because they can be accessed quickly and easily by the CPU.

1000037140.jpg

Data types

  1. Basic Data types (Java Primitive data types - #8)

    1000037147.jpg

    Fixed-point numbers are used to ensure 100% accuracy of a number's value. In contrast, using float or double types can lead to slight variations in the value across different systems due to differences in CPU architecture.

    For example, Computer A might represent a number as 1.589, while Computer B could represent it as 1.59, and Computer C as 1.58900000.

    These variations occur because different systems handle floating-point numbers differently based on their CPU architecture.

    To ensure 100% accuracy, we use fixed-point numbers, especially in critical applications like banking systems or POS systems, where precision is essential.

    Primitive Data Types


    Signed integers ( - to + )



    Unsigned integer (+ only)

    Type inference, sometimes called type reconstruction, refers to the automatic detection of the type of an expression in a formal language.

    example : Python

             Java 11 to up version has this feature (implicitly check) 
    

    How to declare a variable in java with syntax

    identifier [= value]{, identifier[=value]}

    var identifier = value {,identifier = value}

    Screenshot from 2024-09-10 18-17-42.png


How to declared variable in Java

int x = 10; // already data type declared - implicit

var x = 5> 2; // Boolean

var x = 20+2; //int

var = 30.5; //double