Get startedGet started for free

Printing as a calculator

Computers excel at performing calculations instantly. Rather than computing values by hand, you can let Java do the math for you and display the results. Let's see this in action!

This exercise is part of the course

Introduction to Java

View Course

Exercise instructions

  • Print the result of 1+3 to the output.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

class Calculator {
	public static void main(String[] args) {
    	// Print the result of 1+3
        System.out.println(____);
    }
}
Edit and Run Code