Beginning Programming with Java For Dummies
Book image
Explore Book Buy On Amazon
The late 1980s saw several advances in software development, and by the early 1990s, many large programming projects were being written from prefab components. Java came along in 1995, so it was natural for the language's founders to create a library of reusable code. The library included about 250 programs, including code for dealing with disk files, code for creating windows, and code for passing information over the Internet. Since 1995, this library has grown to include more than 4,000 programs. This library is called the Application Programming Interface (API).

Every Java program, even the simplest one, calls on code in the Java API. This Java API is both useful and formidable. It's useful because of all the things you can do with the API's programs. It's formidable because the API is so extensive. No one memorizes all the features made available by the Java API. Programmers remember the features that they use often, and look up the features that they need in a pinch.

So many ways to write computer programs

To write Java programs, you need four tools:
  • A Java compiler
  • A Java Virtual Machine.
  • The Java API.
  • The Java API documentation.

The Java smorgasbord

This section explains some of the terminology you might see as you travel through the Java ecosystem.

Medium Java, little Java, and gigantic Java

At some point, you may see mention of Java SE, Java ME, or Java EE. Here’s the lowdown on these three kinds of “Java E”:
  • Java Standard Edition (Java SE): This is the only edition you should think about (for now, anyway). Java SE includes all the code you need in order to create general-purpose applications on a typical computer. Nowadays, when you hear the word Java, it almost always refers to Java SE.
  • Java Micro Edition (Java ME): The Micro Edition contains code for programming special-purpose devices such as television sets, printers, and other gadgets.
  • Java Enterprise Edition (Java EE): In 1999, the stewards of Java released an edition that was tailored for the needs of big companies. The starring role in this edition was a framework called Enterprise JavaBeans — a way of managing data storage across connected computers. In 2017, Oracle walked away from Java EE, handing it over to the Eclipse Foundation, which renamed it Jakarta EE.
The rest of this book deals exclusively with Java Standard Edition.

How do you type this stuff?

A computer program is a big piece of text. So to write a computer program, you need a text editor — a tool for creating text documents. A text editor is a lot like Microsoft Word, or like any other word processing program. The big difference is that the documents that you create with a text editor have no formatting whatsoever. They have no bold, no italic, no distinctions among fonts. They have nothing except plain old letters, numbers, and other familiar keyboard characters. That's good, because computer programs aren't supposed to have any formatting.

A document with no formatting is called a plain text document.

Documents without formatting are fairly simple things, so a typical text editor is easier to use than a word processing program. (Text editors are a lot cheaper than word processing programs, and they're lightning fast. Even better, text editors take very little space on your hard drive.)

You can use a word processor, like Microsoft Word, to create program files. But, by default, word processors insert formatting into your document. This formatting makes it impossible for a Java compiler to do its job. Using word processors to write Java programs isn't recommended. But, if you must use a word processor, be sure to save your source files with the .java extension. (Call a file SomeName.java.) Remember, also, to use the Save As command to save with the plain text file type.

Using a customized editor

Even if you don't use an integrated development environment, you can use other tools to make your programming life easy. Think, for a moment, about an ordinary text editor — an editor like Windows Notepad. With Notepad you can
  • Create a document that has no formatting
  • Find and replace characters, words, and other strings
  • Copy, cut, and paste
  • Print
  • Not much else
Notepad is fine for writing computer programs. But if you plan to do a lot of programming, you may want to try a customized editor. These editors do more than Windows Notepad.

They have

  • Syntax highlighting
  • Shortcuts for compiling and running programs
  • Explorer-like views of your works in progress
  • Code completion
  • Other cool stuff
When it comes to choosing a custom editor, one favorite is IntelliJ IDEA. IntelliJ Idea comes in two different editions: Ultimate Edition or Community Edition. The Community Edition is free. To download the IntelliJ IDEA Community Edition, visit www.jetbrains.com/idea/download.

About This Article

This article is from the book:

About the book author:

Dr. Barry Burd holds an M.S. in Computer Science from Rutgers University and a Ph.D. in Mathematics from the University of Illinois. Barry is also the author of Beginning Programming with Java For Dummies, Java for Android For Dummies, and Flutter For Dummies.

This article can be found in the category: