Skip to content

Latest commit

 

History

History
67 lines (41 loc) · 2.8 KB

File metadata and controls

67 lines (41 loc) · 2.8 KB

Unit 2 — Java Basics

Free forever · Browser-based · No setup required Back to course


Overview

Students will gain proficiency in the fundamental building blocks of Java programming. They will learn to declare and use variables, understand different data types, and follow Java naming conventions.

By the end of this unit, students will be able to write simple but functional Java programs and understand the importance of proper code documentation.


Learning Flow

Each lesson in this unit follows the same structure:

  • Read the concept
  • Study the example
  • Write or modify Java code
  • Compile the program
  • Run the code
  • Review the output
  • Complete a hands-on lab
  • Answer review questions

Topics Covered

Variables and data types

A variable is a named container that holds a value. Java is a strongly typed language, which means every variable must have a declared type. Common data types include int for whole numbers, double for decimal numbers, char for single characters, boolean for true/false values, and String for text. Students will practice declaring variables, assigning values, and understanding how Java stores data in memory.

Naming conventions

Java follows specific naming conventions that make code readable and professional. Variable and method names use camelCase, where the first word is lowercase and each following word starts with a capital letter. Class names use PascalCase, where every word starts with a capital letter. Constants are written in all uppercase letters with underscores between words. Following these conventions is standard practice in professional Java development.

Basic input and output operations

Students will learn to display output using System.out.println and to accept user input using the Scanner class. These are the foundational tools for writing interactive Java programs.

Comments and documentation

Comments allow developers to explain their code without affecting how it runs. Java supports single-line comments using double forward slashes, multi-line comments using slash-asterisk notation, and documentation comments used to generate API documentation. Writing clear comments is an important professional habit that makes code easier to read, maintain, and share.


Recommended Academic Levels

This unit is included in all academic level tracks.

Academic Level Track
High School Units 1–7
College / University — Year 1 Units 1–8
College / University — Year 2 Units 1–11
College / University — Year 3 Units 1–13

Start this unit Terms of Use · Privacy Policy

© Java Pro Academy. All rights reserved.