Introduction to Java
The word 'Java' has various meanings. It is the name of a programming language, a slang term for coffee, and the name of an island. For the sake of staying on topic, we will be discussing Java the programming language :)
Java was invented by Sun Microsystems.
This tutorial focuses on:
- What you should already know
- What is Java?
- Java file extensions
- What can be done with Java?
What you should already know
What is Java?
Java is a programming language used to develop software applications as well as applets that run on webpages.
- Java is a high level language - Java's syntax allows for the use of words and commands instead of just symbols and numbers, it is closer to human languages and further from machine language. The advantage to Java being a high level language is that it is easier to read, write, and maintain.
- Java is an object oriented language - Define your own reusable data structures called objects as well as their attributes (properties) and things they can do (methods). You can also create relationships between various objects and data structures.
- Java is a software development language AND a web language - Create programs and applets (small programs that run on webpages).
Java is platform independent -
You can run the same Java programs on various operating systems without having to rewrite the code, unlike
other programming languages such as C and C++. Java source code is not converted into machine language, but into a special form of instruction known as Java byte code which is then interpreted by the Java run-time environment which instructs the operating system on what to do. This allows Java programs to run the same way on all operating systems.
Learn more about how source code becomes a program
Java file extensions
Java source code files have a .java extension. Java programs have a .class extension.
What can be done with Java?
- Interact with the user - You can do things like ask the user for their name and print a custom message with it such as "Hello Roger!"
- Create graphical programs - Graphical programs which can include components like buttons, textboxes, menus, and checkboxes. For example, you can create a simple text editing program such as Window's Notepad.
- Create applets - An applet is a program that runs within another program. With Java, you can create applets that will run inside webpages. For example, you can create an applet that will get input from the user and store it in a database.
- Respond to events - Make certain things happen when events like a window being minimized or a button being clicked occur. You can do things like issue a message to the user, display/hide certain data, or even create animations.
- Communicate with databases - Read data stored in a database or write new data to a database. For example, you can store a users name and e-mail address, and allow them to view this information and change it if necessary, and the changes will be reflected in the database.
All this and more can be done with Java!