Introduction

Popularity of Java
Popularity of Java
CC SA: https://en.wikipedia.org/wiki/File:Tiobeindex.png

Java is a general purpose, object-oriented programming language. It was created in 1995 by James Gosling.  It is owned by Oracle and more than 3 billion devices run Java! Java has a wide range of applications such as:

  • Mobile applications
  • Desktop applications
  • Web applications
  • Games
  • Database connection

This exercise will guide you through making the first Java program. Happy journey!

Task

Hard Core Programming
Hard Core Programming
Public Domain: https://openclipart.org/detail/193012/man-working-at-computers

Java is a high-level programming language. The beginning, or starting the Java journey can be a difficult, at first, but after learning the methods and getting used to employ the tools shown here, it is not that hard. Actually, coding Java can be rather easy.

This tutorial guides you through installing the Java, Java IDE and creating the first program. That is called 'Hello World', and it is a kindly reminder from your Java program to the world.

The links provided here gives more information about Java technology (https://java.com/en/download/help/whatis_java.html), and some tutorials (https://beginnersbook.com/java-tutorial-for-beginners-with-examples/ and https://www.w3schools.com/java/). You might find those interesting after finishing this tutorial. Ev3dev.org (https://www.ev3dev.org/docs/programming-languages/) shows how to use Java language to program you favourite LEGO Mindstorms robot. See also http://ev3dev-lang-java.github.io/#/ for more information about programming robots in Java.

The videos consider if Java is Still Worth Learning in 2021, and some introductory tutorials (Java Programming Tutorial 1 - Introduction to Java and Introduction to JAVA - Episode 1 - Hello World). Sometimes, it is easier to follow the videos than the written documents. Please apply both methods

 

Process

    To create a Java program, we need to make multiple things:
  • Create a Java Project and module
  • Create a package
  • Create a class
  • Write a program

All these steps are described below.

  1. Install Java programmming language. Use the tips given at page 5 of the Introduction to JAVA.pdf document. You might need superuser privilegies to install all the packages needed. Actually, we install an IDE (Integrated Development Environment). There exists numerous amount of different IDEs, but we will use Eclipse
  2. Create a project, a module, a package and a class by following the guide from page 11. A class is a way of grouping data and instructions that belong together.
  3. See more information about classes on the page 16. 
  4. Start creating our HelloWorld Java program from Page 17. You need a main function, similar to that in Python.
  5. Run your program. That is shown on page 21.
  6. Page 22 gives you a challenge, using the same println command. How can you print that image on the screen? Note that println command seems a bit fancy; actually it reads System.out.println("Hello World"), and that is because Java is platform independent language. The same command works on Android mobile phone, computer or on LEGO Mindstorms robot, though their displays (or monitors) are totally different.

 

Conclusion

  • You should have a working HelloWorld class that prints out a message to the user.
  • You should know what is an IDE, why to use Eclipse and why Java is so popular languages.
  • You understant the meaning of long println() command.
  • Also, you know what is a class, package or module. You can create a new project. Java is high-end programming language and it gives endless possibilities.

Next steps:

  • Follow the tutorials given at Links and at the videos.
  • Move on to the second Level 3 Java exercise.

Learning Objectives

Learning Objectives

  • You know how to download Eclipse and Java.
  • you understand the meaning of printing on different platforms.
  • You can make a new java project, package and class.
  • You Know what is IDE and how Eclipse is related to that.
  • You know how to write a basic program in Java using System.out.println().