Java | The School of Code

Settings

Appearance

Choose a typography theme that suits your style

Java

Build applications with Java.

1

Hello World

Java requires a class for every program. The entry point is public static void main.

Example

Run this example to see how it works and then try the exercise.

example.java
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Print "Hello, World!" using System.out.println()

main.java
Loading...
Output
Click "Run" to execute your code...
Quiz

What is the entry point method signature in Java?

SUMMARY

In this section, you learned how to print output to the console. Next, you'll learn how to declare variables and work with different data types.

2

Variables and Data Types

Java is statically typed with primitive and reference types.

Example

Run this example to see how it works and then try the exercise.

example.java
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Create name (String) and experience (int) variables

main.java
Loading...
Output
Click "Run" to execute your code...
Quiz

Which of these is NOT a primitive type in Java?

SUMMARY

In this section, you learned how to declare variables and work with different data types. Next, you'll learn how to perform mathematical operations.

3

Arithmetic Operations

Java supports all standard arithmetic operations with specific rules for integer division.

Example

Run this example to see how it works and then try the exercise.

example.java
Loading...
Output
Click "Run" to see the example in action...
Exercise

Your task: Calculate area and print "Area: {area}"

main.java
Loading...
Output
Click "Run" to execute your code...
Quiz

What is the result of 17 / 5 in Java (both are int)?

SUMMARY

In this section, you learned how to perform mathematical operations. Next, you'll learn how to manipulate and work with strings.

Unlock 10 More Lessons

You've completed the free preview! Upgrade to Pro to access all 12 lessons in this course, plus advanced projects and certificates.

Locked lessons:
  • String Operations
  • Conditionals
  • For Loops
  • While and Do-While
  • Methods
  • Arrays
  • ArrayList
  • Classes and Objects
  • Final Project: Student Grade System
Hello World 1
Variables and Data Types 2
Arithmetic Operations 3
Unlock 10 more lessons Access all content with Pro
Upgrade
String Operations 4 Conditionals 5 For Loops 6 While and Do-While 7 Methods 8 Arrays 9 ArrayList 10 Classes and Objects 11 Final Project: Student Grade System 12

Reset Progress?

Are you sure you want to reset all progress for this course? This action cannot be undone.