Back to blog

2022-09-23

My First Java Program

The first Java program I wrote while learning programming basics.

The Goal

Java was the first programming language I learned in school. At the time the goal was simple: understand what programming actually does and how code turns into output.

This small program was my introduction to variables and basic data types in Java.

My first Java program

What the Program Does

The program shows how Java stores different types of data and prints them to the console.

Some of the variables used:

  • int for whole numbers
  • float for decimal numbers
  • char for a single character
  • boolean for true or false values
  • String for text

Example variables from the program:

int x = 9, y = 3, z = 50;
int myNum = 27;
float myFloatNum = 2.663f;
char myLetter = 'A';
boolean myBool = true;
String myText = "Aban";