Leave a comment

Introduction to Java – Part I

Java, on the whole, can be divided into 2 parts :

  • Programming language – this is basically a specification which describes various rules for writing a program in Java
  • Platform – this refers to the underlying system for running a Java application.


There are 3 main Java platforms:

  • Java SE
  • J2EE
  • J2ME

The 2 elements of Java SE platform are:

  • JRE (Java Runtime Environment) – this can be explained as a collection of various libraries and components required to run a Java application.
  • JDK (Java Development Kit) – this is nothing but the Java platform. This is actually the super set which contains JRE along with some tools like compiler, debugger. In JDK, we also have JVM and Java APIs which it shares with JRE.

JVM : Java Virtual Machine

This is a part of JDK which ensures the platform independence of Java. When a Java program is compiled it generates bytecode. This is interpreted by JVM and gets enabled for execution on a particular Operating System. Since the JVM interprets and then, executes the bytecode, a Java program might be a bit slower than languages where a program gets compiled to native code. Another point about Java SE platform is that, it uses JIT (Just in Time) compiler. JIT compiler actually compiles the bytecode on the fly to native machine code while interpretation so that it can be executed directly on the machine processor.

Java APIs : Java Application Programming Interface

This is the collection of libraries containing related components to provide ready-made functionality to a Java application. e.g. Graphic, security, networking etc.

Developing and executing a Java application:
A Java application can be developed using any text editor like notepad. Generally, it is suggested to use a simple text editor instead of an IDE while learning Java. The reason for this is that you’ll understand even minute details and restriction of the language. After writing the application, it needs to be compiled which can be done on any machine with Java compiler. When we write a Java application, it is stored with .java extension. Once it is compiled, we get a file with .class extension which contains the compiled bytecode of Java program. This bytecode is platform independent and can be executed by any JVM. We do not need to compile our .java file again for any particular platform or operating system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: