Data Types and Variables
Learn Data Types and Variables (Java Basics, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
1. Introduction A data type tells Java what kind of value a variable can hold and how much memory it needs Java is statically typed, so the type is declared first and checked by the compiler. There are eight primitive types (byte, short, int, long, float, double, char, boolean) that hold the value directly, and reference types such as String, arrays, classes and enums that hold the address of an object . Var is only local type inference, the exact static type is still written into the class file.
More lessons in Java Basics
- Introduction to Java
- Getting Started with Java (Installation & Setup)
- Features of Java
- Difference between JVM, JDK, JRE
- Access Specifiers
- Operators in Java
- Control Statements in Java
- Jumping Statements in Java
- Looping Statements
- Packages
- Array in Java
- Array Program
- String in Java
- Constructor in Java
- Constructor Chaining
- Static Keyword
- Input and Output Stream in Java
- Scanner in Java
- Serialization in Java
- Properties File in Java
- Final Keyword
- Wrapper Class
- Methods in Java
- Return Object from Method
- Different way to return to the method in java.
- This and Super Keywords