Docsity

Datatypes and Variables in Java, Cheat Sheet of Java Programming

Partial preview of the text

Download Datatypes and Variables in Java and more Cheat Sheet Java Programming in PDF only on Docsity!

Java Fundamentals

Course

Module 3

Variables & Datatypes

in Java

Introduction

โ— (^) Java is a strongly typed language, meaning variables must be declared with a specific type before they can be used โ— (^) Variables contain data that can be used in a Java program โ— (^) There are 8 primitive data types in Java: byte, short, int, long, float, double, char, Boolean.

Primitive Data Types

โ— (^) Byte - 8 bit integer (-128 to 127) โ— (^) Short - 16 bit integer (-32,768 to 32,767) โ— (^) Int - 32 bit integer (-2,147,483,648 to 2,147,483,647) โ— (^) Long - 64 bit integer โ— (^) Float - 32 bit floating point โ— (^) Double - 64 bit floating point โ— (^) Char - 16 bit Unicode character โ— (^) Boolean - true or false

Conclusion

โ— (^) Java is a strongly typed language with 8 primitive data types โ— (^) Variables must be declared before use with a specific type โ— (^) The final keyword can be used to create constants โ— (^) Choosing the right data type for a variable is important for efficiency and accuracy

Thank you. Please feel free to ask any

questions. ๐Ÿ˜„