Primitive data types include basic data types like int and float, while non-primitive types include String and arrays. Type casting can be either widening, which automatically converts smaller types to larger, or narrowing, which requires manual conversion of larger to smaller types. Arrays allow storing multiple values in a variable and can be one-dimensional like a list of animal names or multi-dimensional like a grid of numbers.
Primitive data types include basic data types like int and float, while non-primitive types include String and arrays. Type casting can be either widening, which automatically converts smaller types to larger, or narrowing, which requires manual conversion of larger to smaller types. Arrays allow storing multiple values in a variable and can be one-dimensional like a list of animal names or multi-dimensional like a grid of numbers.
Primitive data types include basic data types like int and float, while non-primitive types include String and arrays. Type casting can be either widening, which automatically converts smaller types to larger, or narrowing, which requires manual conversion of larger to smaller types. Arrays allow storing multiple values in a variable and can be one-dimensional like a list of animal names or multi-dimensional like a grid of numbers.
byte, short, int, long, float, double, boolean and char. These are predefined in Java.
Non-primitive data types - String, Arrays,
Classes. Type Casting Widening Casting (automatically) - converting a smaller type to a larger type size byte -> short -> char -> int -> long -> float - > double Narrowing Casting (manually) - converting a larger type to a smaller size type double -> float -> long -> int -> char - > short -> byte Arrays Arrays are used to store multiple values in a single variable String[] animals = {“Dog", “Cat", “Cow", “Pig"};