Java Basics

In this chapter we explore essential building blocks that every programmer needs to grasp. First, we delve into working with variables, where you'll discover how to declare and initialize them, ensuring your programs can store and manipulate data efficiently. Variables are the cornerstone of your programs. Next, we examine Java data types, covering everything from integers and floating-point numbers to characters and booleans. Choosing the right data types is crucial to your logic. We will also cover data type conversion, where you will learn how to switch between data types and why it is important. Finally, you’ll learn the fundamentals of arithmetic in programming. It might remind you a bit of learning Algebra and PEMDAS.

Updated

Java Projects

  1. Java Maven Project (Novice): Create a Maven project in IntelliJ IDEA, find your way around its folders, and write and run your first Java class.

Working with Variables

  1. What is a Variable (Novice): A variable is a named place where your program remembers a value; declare it with a type and a name, give it a value, print it, and name it by Java's rules and conventions.

Working With Data Types

  1. Working With Data Types (Novice): Every Java variable has a data type that decides what it can hold (whole numbers, decimals, a single character, text, or true and false), and each type has its own way to write a literal value.

Converting between Data Types

  1. Converting between Data Types (Apprentice): Java converts a smaller number type to a larger one for you; anything else you convert yourself, with a cast for numbers or a parse method such as Integer.parseInt for text.

Arithmetic and Expressions

  1. Arithmetic and Expressions (Novice): Do arithmetic in Java with +, -, *, / and %, see why dividing two ints drops the remainder, and follow the order in which Java works out an expression.