Java Introduction5 min read

  • Post author:
  • Post category:Tutorials

Java is a popular general-purpose, high level, modern programming language, and computing platform. It is fast, reliable, secure, and dynamic, with the ability to fit the needs of virtually any type of application.

It is Platform Independent, which means the user only needs to write a program once and it can be run on a number of different platforms such as Windows, Mac OS, and the various versions of UNIX

It was created by James Gosling from Sun Micro-systems (Sun) in 1991. It was first publicly released in 1995 with the version of Java (Java 1.0). According to Oracle, Java runs on 3 billion devices worldwide

Nowadays, Java is used almost in every field that is desktop to web applications, mobile applications, in gaming consoles, cell phones to the Internet, data connection, servers, and many more.

 Main Features of Java:

  • Object-Oriented
  • Platform Independent
  • Simple and secure
  • Portable
  • Robust
  • Dynamic
  • Multi-threaded
  • High Performance
  • Compiled and Interpreted
  • Distributed.

JAVA Basic Example to print “Hello World”:

Let’s understand briefly on each of the features.

1. Object-Oriented:

Java is an object-oriented programming language. OOP divides the program into a number of objects and makes it simpler. This Object has some data and behavior which is used inflow of data from one function to another. Users can easily extend java as it is based on Object Model. Therefore understanding OOP is an important step to learn Java Programming.

Basic concepts of OOPs are:

  • Object
  • Class
  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation

2. Platform Independent:

Unlike other programming languages such as C, C++, etc, which require a specific platform to be compiled whereas Java is compiled into byte-code and this byte-code is Platform Independent.

This means Java is only required to write-once and can be run on any platform such as Windows, Linux, Mac OS, etc. This byte-code is interpreted by the Java Virtual Machine (JVM).

3. Simple and secure:

Java is very easy to learn, clean, and easy to understand. Java language is a simple programming language because of its C++ syntax.

Java is also best known for the security that it provides and enables us to develop virus-free systems. it is secured because java programs run inside the virtual machine sandbox.

4. Portable:

As mentioned above, the byte-code is Platform Independent and can be carried to any other platform for execution of Java program that makes Java code portable.

5. Robust:

Robust means strong. Java is strong and reliable because of its ability for early checking for errors, mainly on a compilation error and run-time checking.

6. Dynamic:

Since Java is designed to adapt to a transformed environment, it makes java dynamic. it is considered to be more dynamic than C or C++. Java supports the dynamic loading of classes and compilation and garbage collection.

7. Multi-threaded:

This feature in Java allows Java to perform more than one task at once by defining multiple threads for maximum utilization of CPU. The advantage of the use of Multi-threaded is that it does not require to occupy space in memory for each thread instead it shares the common memory space.

8. High Performance:

Java-enabled High performance by introducing JIT- Just In Time compiler, that is the compiler only compiles the code or method that is called, making the compilation process faster and consume less-time.

9. Compiled and Interpreted:

Java has both Compiled and Interpreted feature where the compilation feature allows to create byte code after compilation. And after, the byte codes are converted into Machine Language with the help of the Interpreter. Hence both the features are required for the execution of Java Code.

10. Distributed:

Java is distributed because it allows users/developers to create distributed applications that are designed to run on computer networks. RMI(Remote Method Invocation) and EJB(Enterprise Java Beans) are used for creating distributed applications.

In other words, this feature allows the user to access the files from any machine that is connected to each other on the internet.

These are some of the features of java.


Java Basic Syntax

The syntax of the Java programming language is the set of rules for writing the java programs and defining its interpretation. Java program is the collection of classes and objects that communicate with each other via. method. It is the program structure.

There are certain features that are omitted such as operator overloading or unsigned integer types, also there are no global functions or variables, but there are data members which are regarded as global variables.

Before starting programs, it is very important to remember the following points.

1. Case Sensitivity:

Java is case sensitive, which means identifier Hello, heLlO and hello, all have a different meaning in Java.

2. Class Names:

Class names should always begin with Upper Case. If more than one word is used to form the name of the class, then each inner word’s first letter should be in Upper Case.

Example: class MyFirstJavaLesson, class StudentsDetails, etc.

3. Method Names:

All method names should begin with a Lower Case letter. If more than one word is used to form the name of the method, then each inner word’s first letter should be in Upper Case.

Example: public void myFirstMethod(), public void myStudentDetails() etc.

Note: public static void main(String args[]):
All Java program processing begins from the main() method which is a mandatory part of every Java program.

4. Program File Name:

The name of the program file should always match the class name. While saving the file, it should be saved with the class name and append ‘.java’ to the end of the name. Note that if it doesn’t match with the class name then the program will not work.

Example: consider that ‘MyFirstJavaCode’ is the class name. Then the file should be saved with the name ‘MyFirstJavaProgram.java’.

JAVA Basic Example to print “Hello World”:

This the very basic way to write a program. The program below print “Hello World”.

This shows the format for writing java code in the code editor. This is the basic one. To learn more about how to write java with function and multiple classes, navigate through our website, and learn more.

MORE

Java – Object-Oriented Programming concept

Object-oriented programming: It is the concept of using objects in programming. It is a paradigm that uses objects and classes that aim to implement real-world …
Read More

Method Overriding and Method Overloading in Java

Here you will learn about method overloading and method overriding with syntax and various examples and also some rules for overriding. Let us start with …
Read More

Understanding Listening skill

Listening is the most important of all communication skills as we spend most of our time listening rather than other skills. It is an active …
Read More

Understanding Reading Skills

Reading skills are capacities that relate to an individual’s ability to peruse, fathom, decipher, and disentangle composed language and writings. Uncommon perusing abilities can be …
Read More

Path after BCA (Bachelor in Computer Application)

This article is specially written for BCA(Bachelor in Computer Application) and IT(Information Technology) students, keeping the mind of their computer background. This is common that …
Read More

Understanding Writing Skills

Writing skill is a vital part of communication skill. A good writing skill helps you to convey your message to one or a big crowd …
Read More