Java: Introduction & Reference Material.

Java: Introduction & Reference Material.

INTRODUCTION:

In short, Java is the most popular programming language highly used everywhere from general to the scientific computer, static to a real-time system. Actually, Java can be defined as a platform and High level, robust, secured and Object-Oriented Programming Language. Why I said platform because Java has it’s own runtime environment, therefore it is called platform. Basically, there are two types of platforms, namely, software-based and hardware-based. Java provides a software-based platform.

History: Java was first developed by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan in 1991 at Sun Microsystem. It was initially called ‘oak’ but was renamed as Java in 1995.

Features of Java

Simple:

Java is easy to write and understandable high level, object-oriented language. Java programmer doesn’t have to worry about pointer because Java provides manage memory explicitly. Java also eliminates operator overloading and multiple inheritances. In addition, It is always easier for programmers to learn it after c++.

Java is Object-Oriented:

Java is a fully object-oriented language which follows all the rules of OOPS like inheritance, abstraction, polymorphism, etc. and everything can be treated in the form of objects.

Compiled and Interpreted:

A computer language is either compiled or interpreted but Java combines both these approaches thus making Java a two-stage system.

compiler and Interpreter
Figure: compiler and Interpreter

Platform Independent:

Platform independent means that a program can run on any computer system. Java programs can run on any system for which a Java Virtual Machine (JVM) has been installed. JVM provides a runtime environment in which Java bytecode can be executed. This bytecode is a platform-independent code because it can be run on multiple platforms that is Write Once and Run Anywhere (WORA).

High Performance:

Java provides the facility of Automatic Garbage Collection which is run as a low-priority background thread, ensuring the high availability of memory, thus leading to better performance.

Case Sensitive:

Java is a case sensitive programming language.

Dynamic:

While executing the Java program, the user can get the required files dynamically from a local drive or from remote computer thousands of miles away from the user just by connecting with the Internet.

Robust:

Java provides facilities to create a robust program, There is automatic garbage collection in Java. There are exception handling and type checking mechanism in Java. In addition, it checks code at compile-time and runs time. All these points make Java robust.

Secure:

Java is secure because-

  • No explicit pointer
  • C++ uses runtime environment of Operating System while Java uses runtime environment of its own, Java program run inside Java Virtual Machine (JVM).
java security feature
java security feature

Multi-threading:

A thread is like a separate program, executing concurrently. Multi-threading means a single program having different threads executed independently at the same time. And Java supports multi-threading and provides the library for the Thread class. It allows Java programmers to write programs that perform many tasks concurrently.

Java is Faster:

Speed of Java programs is faster compared to other compiler-based languages such as C and C++.

Portable:

Java code is portable it means Java programs can be easily moved from one computer to the other computer system. And Java bytecode can be executed on any machine that has the Java interpreter.

Scripting Language Support:

Java SE6 integrates various scripting languages such as Javascript and PHP Script into the Java platform.

XML Processing and Web Services:

Java SE6 allows the development of Web services and clients that communicate using XML.

Parallel Programming:

Java SE7 facilitates parallel programming through the use of the Fork/Join framework.

Java applications:

Some main applications of Java are:

  • Desktop applications such as acrobat reader, media player, antivirus, etc.
  • Web application
  • Enterprise applications such as banking applications
  • Mobile applications
  • Smart Card
  • Robotics
  • Games etc.

How Java works:

How java works

In simple words, This story begins when you create Java source file and then you submit your Java source file to the compiler(Using command javac <source_file_name.java>). Here, the compiler starts finding errors in your code if the code is correct then your source file will execute correctly. And then compiler creates a new document coded into Java byte-code. You can find it in the same directory, it ends with .class extension. This file is actually platform-independent. And the story ends when the end-user uses Java Virtual Machine to read or run byte-code on his device. Basically, Java Virtual Machine (JVM) is a piece of software embedded into our devices to run the Java byte-code.

Introduction to First Java Program, Step by Step

Step 1. Open your notepad or code editor. Then write the following program

sample code in java
Figure: A Sample java program.

Step 2. Compile your code using the following command. Here command, “javac <sourceFile_name.java” is used to the compilation of your code.

compilation command in java
Figure: compilation

after successful compilation of your code, you can see a new file having .class extension, This new file is called java bytecode.

new file with .class extension
Figure: new file with .class extension.

Step 3. To run the program, use the following command “java <sourceFile_name>”. It will interpret the bytecode file to machine code.

java run command
Figure: run command.

Some words from the author’s keyboard

If this article was helpful to you please tell me in the comment section. In addition, if you have some suggestion regarding this article please email or comment. After that, I will consider your suggestion and take action on it. Thank you for scrolling my page. Sending Love from my keyboard 🙂

2 Replies to “Java: Introduction & Reference Material.”

  1. I was just seeking this information for a while. After 6 hours of continuous Googleing, at last I got it in your site. I wonder what is the lack of Google strategy that do not rank this type of informative sites in top of the list. Usually the top sites are full of garbage.

  2. I have to point out my love for your kindness for men who really need help with your area of interest. Your personal dedication to getting the solution all around had been extremely beneficial and has all the time allowed folks like me to achieve their pursuits. This warm and helpful hints and tips means a whole lot to me and especially to my fellow workers. Best wishes; from all of us.

Leave a Reply

Your email address will not be published. Required fields are marked *