So, you want to learn Java? Well, you aren't the only one. Recently on the forum I have seen countless users with barley any Java experience begging for help, so I thought I would make some tutorials to answer there questions. Here we begin! Part 1: The Java Virtual Machine(JVM)
Java - One of the most powerful, demanding programming languages in the industry today. Here is the start of your journey to learn it.
The Java Virtual Machine is what makes Java, well, Java. The JVM compiles Java by turning it into the Java byte code and is then moved into the JRE, which is mentioned later in this paragraph. But here is a little test, can you guess why it is called the JVM? Because it turns all the code into the extension depending on the operating system! This is what makes Java so portable, that it can run on any machine. The idea of write once, run anywhere was first introduced by Java. The JIT(Just in time) compiler makes it so that Java can get the OS, and on the fly convert it to the extension that the machine can run. Java was an important invention from the day it came out, but could not compare to languages like C and C++ at first, because of its slow speed. Now, Java is about a second slower than C++ on runtime, which is very impressive. Later on in the series you will learn more about this, but lets move on. The JRE is the Java Runtime Environment. A Runtime Environment is kind of straight forward. At runtime this is called to execute the program. The JRE holds the JVM, class files and other necessary files(like interfaces which you will learn about later.) Another extremely important process you will need to know about is called, "Linking". This was first introduced in Assembly(One of the old age programming languages,) but really brought as something new and exciting through the programming language C. Linking is using multiple files to create one program. The program that is used to make these into one program is called a, "Linker". Here is a diagram of how a linker works, demonstrating a game in c.
Enemy.c -> Linker -> ----------> Game.c
Java does not have this linking feature, because it is OOP(Object Oriented Programming) OOP means that everything is an object. Yes, an object, like the lamp sitting on your desk or the mouse next to your keyboard. But, the exception is, Java is also procedural. Procedural means that there are a set of instructions for the program to execute and complete. The main difference is, OOP thinks in more of a way a human does, as procedural is simply a set of instructions. You will see a lot of both in this series. I'll give you an example to look at.
I want to create a dog, and later on figure out I want it to be a pitbull:
Make a structure of a dog with the capabilities Sniff, Bark and Walk.
Make all dog types.
Find out person wants to walk a pitbull.
Take that dog and walk it.
Object Oriented Programming for the same task:
Make an object called Dog.
Dog has capabilities Sniff, Bark and Walk.
Figure out user needs pitbull.
Make the dog a pitbull.
Walk the dog.
Draw(or type) a diagram of how an animal would process through the JVM and JRE. Post it here on the forum.
1 Replies - 8317 Views - Last Post: 06 July 2012 - 10:40 AM
Replies To: Conquering The Beast: Java for the real world Part 1: The JVM
Page 1 of 1