Computer Design, Code, and Solutions

Learn to Code Java

In this project series I have attempted to document my code exercises and spread the information to as wide an audience as possible. Source code is provided for each step along with basic information, links, and comments. This ensures that beginners have exposure to real material through the learning process.

Precise Delivery of Solutions

// Source code is provided for later reuse.
// All originally authored solutions.

import java.util.Scanner;

public class FirstProgram
{
     public static void main(String[] args)
     {
          System.out.println("Hello out there.");
          System.out.println("I will add two numbers for you.");
          System.out.println("Enter two whole numbers on a line:");

          int n1, n2;

          Scanner keyboard = new Scanner(System.in);
          n1 = keyboard.nextInt();
          n2 = keyboard.nextInt();

          System.out.println("The sum of those two numbers is");
          System.out.println(n1 + n2);
     }
}