1 Replies - 10772 Views - Last Post: 06 July 2012 - 10:40 AM Rate Topic: -----

#1 RCR  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 33
  • Joined: 04-July 12

Conquering The Beast: Java for the real world Part 1: The JVM

Posted 06 July 2012 - 10:38 AM

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.

Files:
Player.c
Enemy.c
Place.c

Player.c ->
Enemy.c -> Linker -> ----------> Game.c
Place.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.

Procedural:

I want to create a dog, and later on figure out I want it to be a pitbull:

Steps:

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.


Assignment:

Draw(or type) a diagram of how an animal would process through the JVM and JRE. Post it here on the forum.

Good luck!

Is This A Good Question/Topic? 1
  • +

Replies To: Conquering The Beast: Java for the real world Part 1: The JVM

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10781
  • View blog
  • Posts: 40,153
  • Joined: 27-December 08

Re: Conquering The Beast: Java for the real world Part 1: The JVM

Posted 06 July 2012 - 10:40 AM

The news and articles forum is for news stories. Perhaps you might consider a blog for this type of post. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1