



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to Java programming concepts, focusing on constants, variables, and data types. Constants are values that do not change, declared using the 'final' keyword and assigned a datatype. Variables are storage locations for values, declared with a datatype and can be assigned values using assignment statements. Data types include numerical types, and the document covers type casting, both implicit and explicit.
Typology: Lecture notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




Constants do not change final datatype CONSTANTNAME = VALUE; final double PI = 3.14159; final int SIZE = 3;
x = 1; // Assign 1 to x; radius = 1.0; // Assign 1.0 to radius; a = 'A'; // Assign 'A' to a;
Implicit casting double d = 3 ; (type widening) Explicit casting int i = (int) 3. 0 ; (type narrowing) int i = (int)3.9; (Fraction part is truncated)