The simplest program

Available

"Hi, Diego!"

"Hi, Amigo!"

"The professor praised me recently. He was glad that I'm making such fast progress thanks to his lessons."

"You're making progress thanks to the professor's lessons?! Oh, sure! Doesn't he realize how funny that is?"

"Well, never mind. I have something interesting for you today. I'll teach you how to write the simplest (or minimal) program. It's very easy. A minimal program consists of one class and contains one method - main(). This is how it looks."

The simplest program
public class MainClass
{
    public static void main(String[] args)
    {
        System.out.println("Kiss my shiny metal rear actuator!");
    }
}

"I've seen that before, so I get it."

"Of course, nobody needs programs like that. The more complicated the problem solved by a program, the cooler the program is. That's why programs normally consist of thousands of classes."

"An average program is written by a team of ten people over 2-3 years."

"What would be considered a big program, then?"

"Maybe a program that takes a team of 100 people 5 years to write."

"500+ human-years? Oh, wow!"

"Yes. Java is one of the best programming languages for writing big and very big programs."

"I'm scared to ask what constitutes a 'very big' program."

"Good for you! You catch on fast."

"Programmers quickly realized that it's difficult to navigate through thousands of classes. They came up with special programs that accelerate the process of writing programs manifold. The bigger the program you're writing, the clearer the benefits."

"So programmers came up with a program for writing programs?"

"Yes. Why are you surprised? A program is above all a tool for automating routine tasks. When you've written code for a couple of years, you'll find there are a huge number of such tasks."

"A program for creating programs is called an Integrated Development Environment (IDE).

Today, you'll see one of them.

No, today you'll see the best of them! It's called IntelliJ IDEA, and it will become your faithful friend for many years ahead. It's like a more experienced companion who always provides hints and help."

"Now that's intriguing!"

"If you aren't going to write programs in Word, then you'll need a good development environment, right? We robots prefer the IntelliJ IDEA Community Edition. Download and install the latest version."

Hint 1
How to find IntelliJ IDEA on Google

Hint 2
Download page for IntelliJ IDEA

Hint 3

"You'll also have to install a Java development kit (JDK). A JDK is a kit for Java developers, created by the founders of the Java platform. It includes a Java virtual machine, Java compiler, and much more that an experienced Java developer might need."

"What's wrong with how I've been writing programs – through the website?"

"That's convenient for small programs, but it's better to write big ones in IntelliJ IDEA. We're preparing you to become a professional programmer, so the faster you master these cool tools, the better. Don't be afraid. This program was created to make your life easier, not more difficult. You'll get used to it quickly. Soon you won't want to touch anything else."

"To learn how to write programs, you need to write programs. For that, install IntelliJ IDEA and a JDK on your computer. Download and install OpenJDK 14."

Hint 1
First of all, visit this page: https://jdk.java.net/14/

It should look something like this:

In the Builds section, click on the version for your OS in order to start the download process.

Unpack the downloaded archive. We suggest you save the unpacked project folder (CodeGymTasks) to a safe destination (e.g. different drive or in the cloud), to avoid accidental removal.

"Let's reinforce the theory with an exercise."

1
Task
Java Syntax,  level 3lesson 1
Locked
Dividing is good
As a well-known paramecium once said, "dividing is good". Higher lifeforms (though not all) are united by this wisdom, including the highest form of life: programmers. Let's write a method to divide one number by another. We'll call it div, and we'll display the result of the division.

In case you face any issues with the JDK installation, do not hesitate to contact our support team by e-mail support@codegym.cc or using chat widget in the lower right corner of the page.

Comments(97)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
BelindaLevel 4 , Portland
14 May, 06:05
I was only able to find JDK 14.0.1 on the Oracle site....
Aleksandar NeshkovskiLevel 6 , Skopje
12 May, 13:18
If you have linux you know what to do.. XD
Maryem VickersLevel 4 , Coalisland
22 June, 17:07
Nope I don't! It's Windows!
Brandon LeirerLevel 7 , Keller
11 May, 20:41
I already have Java 14. Is it important to get Java 8 specifically, or will 14 be fine?
ReginaLevel 41 , Florida
12 May, 16:40
It's fine to have Java 14 installed.
Rahul MahadevLevel 4 , Cambridge
8 May, 16:33
I already downloaded Netbeans. Can I use that instead?
AlexLevel 41
9 May, 07:56
Our plugin was built specifically for IntelliJ IDEA.
BlaiseLevel 19 , London
1 May, 09:54
True, IntelliJ IDEA is the most popular IDE at the company I work for, however it's very heavy on resources. Allow me to recommend my favourite little IDE for users without a cutting edge laptop/desktop: DrJava. http://www.drjava.org/ It's written in Java (runs on the JVM, so you need to install JDK first), it's easy on resources (as far as a Java program can be) and if you don't want to you don't have to waste your time creating projects just to test simple ideas. Just start a new file, enter your code, save the file as *.java then Compile and Run. It's been in beta phase for a long time, also don't expect frequent updates, but it works very well and runs fine on my low-end laptop with 2GB RAM I use for casual browsing/coding. However, no question about it, a professional IDE will speed up your work significantly so it's very recommended to learn how to use them. Also, using one of them helps us look more professional on job interviews :)
Jeremi NuerLevel 5 , San Francisco
18 April, 23:41
Welp, I downloaded JDK and got a virus. wtf.
Brendon MartellLevel 3 , Providence
13 April, 14:55
I have to have an Oracle account in order to download the JDK??
John SquirrelsLevel 41 , Richmond
14 April, 19:13
Yes, you have to. It is Oracle's updated policy. We can not do anything with it. You still can download JDK for free, but not for commercial purposes.
KingBiggieLevel 7 , Bodegraven
16 April, 08:35
To add to this: They require more personal information than most people in Europe would consider acceptable under the new privacy policy in the current personal data protection times.
Robert BobbinsLevel 9 , Pittsburgh
5 May, 21:13
Use open jdk version instead.
JackLevel 4 , Yerevan
10 April, 13:17
why does it print every answer 3 times ??? System.out.println(6/3); System.out.println(10/6); System.out.println(2/4);
AlexLevel 41
10 April, 13:40
Do you have these in a loop in your code?
Rod JohnstonLevel 8 , Melbourne
20 April, 12:30
@ Jack It looks like everything is printing 3 times because main call div 3 times and you have added 3 statements to the div method.. The div method need only contain one line: System.out.println(a/b); As an alternative you could achieve the same outcome as follows: int result = a/b; System.out.println(result);
JackLevel 4 , Yerevan
10 April, 13:02
i cant find the official website for JDK 8 (I'm on 64 bit)
Gellert VargaLevel 10 , Szekesfehervar
19 February, 17:14
To install JDK8 and IntelliJ IDEA on 32 bit Windows XP SP3 If there's anyone else besides me who uses XP, then now i share some of my experiences of installation. (Perhaps these informations will save you hours of google search and several failed installation attempts...) Officially the JDK7 is the latest JDK version which is compatible with XP. But i think the JDK8 is better than 7. And, several users says the "JDK8 Update 151" is the last one that can be cleanly installed and run on XP. Unfortunately, you can't download these old versions from the official oracle website. But you can find it for example on github here: https://github.com/frekele/oracle-java/releases/tag/8u151-b12 Choose the jdk-8u151-windows-i586.exe (198MB) file. I found so this one finally can be installed and it really works with XP. (Older or newer JDK8 versions gave me bugs or they are can't be installed.) I found so, the IntelliJ IDEA 2018.3 whereof they said it will work with XP, got stucked after the installing, when you have to select the containing directory for JDK. So, i had to look for an older version of IntelliJ IDEA. Finally i successfully installed the IntelliJ IDEA 2017.1 version. You can find this version, the "ideaIC-2017.1.6.exe" file here: https://www.jetbrains.com/idea/download/other.html choose this line: "2017.1.6 for Windows (exe)" (in this column: "IntelliJ IDEA Community"). These two program versions at last are compatible with each other and with my 32 bit Windows XP, too.