• 4 hours
  • Easy

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 12/12/19

Write Java code on a Text Editor

Tapping away in online code environments is a great way to get started with Java, but if you're serious about learning it, at some point, you'll have to start writing Java programs on your computer. This will allow you to expand in your knowledge of Java by working on big coding projects and contributing to open source projects in the real world!

What can I use to start writing code on my own computer?

Like we mentioned in the video, Java developers use something called an IDE.  An IDE (integrated development environment) is a series of development tools that are all grouped together in one place, which you download and use on your computer. With this environment, you are able to do everything from writing, building, testing, and deploying code for your application.

But, you don't have to use an IDE to build a Java application. If you find an IDE a bit intimidating, there is a simple solution called a text editor! Let’s take a look at a basic one: Notepad.

Using Notepad

Notepad isn't specially designed for writing code (as you may guess, it's for notes), but you can use it to write your first few lines on your computer. Start by going into your Windows Start menu and looking up Notepad.  Once you've found it, click on the Notepad icon to open it up.

In the top left corner of the Notepad window, you'll see the File menu.  Click on it to reveal the drop-down menu, and select "Save As." Name it TestJava.java.

Saving a Java file in Notepad
Save file in Notepad

Now you have a Java document that you can start writing your code on. Copy and paste the following code on the text editor on your computer:

public class TestJava {

   public static void main(String[] args) {

       System.out.println("I am using Notepad!");

   }

 

Your Java code should now look like this:

Java Code on Notepad
Java code on Notepad

This is a bit sad, right? It's hard to read, which will make detecting mistakes pretty tough:

Can you see the mistake?
Can you see the mistake?

You can't see it very well, can you? That'll make it time-consuming to find mistakes, and if you're just starting out, you'll make a lot of them (if you don't, you're not writing enough code)! Writing on a text editor could even be bearable if you have a little bit of code, but not if you have lines and lines of it. Plus, you have to type out everything. Think of all the curly braces or commands you'll have to write again and again. I'm bored already.

You could say, hey, it's not so bad! Notepad is a free text editor, after all.  But what if I told you that there is free code editor software out there that is much better?  Let’s check it out in the next chapter. 

Summary

  • You need specific tools to code on your computer.

  • Developers typically use IDEs (integrated development environments) to code. 

  • You can use a free text editor like Notepad, but it has limited features.  

Example of certificate of achievement
Example of certificate of achievement