What is Java?
Java is a programming language and a platform. Java is a high level,
robust, object-oriented and secure programming language.
Java was developed by Sun Microsystems (which is now the subsidiary of
Oracle) in the year 1995. James Gosling is known as the father of Java.
Platform: Any hardware or software environment in which a program runs,
is known as a platform. Since Java has a runtime environment (JRE) and
API, it is called a platform.
Application
1. Desktop Applications such as acrobat reader, media player, antivirus,
etc.
2. Web Applications such as irctc.co.in, javatpoint.com, etc.
3. Enterprise Applications such as banking applications.
4. Mobile
5. Embedded System
6. Smart Card
7. Robotics
8. Games, etc.
Features of Java
Simple
Java is very easy to learn, and its syntax is simple, clean and easy to
understand. According to Sun Microsystem, Java language is a simple
programming language because:
o Java syntax is based on C++ (so easier for programmers to learn it after
C++).
1|Page
, o Java has removed many complicated and rarely-used features, for
example, explicit pointers, operator overloading, etc.
o There is no need to remove unreferenced objects because there is an
Automatic Garbage Collection in Java.
Object-oriented
Java is an object-oriented programming language. Everything in Java is an
object. Object-oriented means we organize our software as a combination of
different types of objects that incorporate both data and behaviour.
Platform Independent
Java is platform independent because it is different from other languages
like C, C++, etc. which are compiled into platform specific machines while
Java is a write once, run anywhere language. A platform is the hardware or
software environment in which a program runs.
Secured
Java is best known for its security. With Java, we can develop virus-free
systems. Java is secured because:
o No explicit pointer
o Java Programs run inside a virtual machine sandbox
Robust
The English mining of Robust is strong. Java is robust because:
2|Page
, o It uses strong memory management.
o There is a lack of pointers that avoids security problems.
o Java provides automatic garbage collection which runs on the Java
Virtual Machine to get rid of objects which are not being used by a Java
application anymore.
Architecture-natural
Java is architecture natural because there are no implementation dependent
features, for example, the size of primitive types is fixed.
Portable
Java is portable because it facilitates you to carry the Java bytecode to any
platform. It doesn't require any implementation.
High-performance
Java is faster than other traditional interpreted programming languages
because Java bytecode is "close" to native code.
Distributed
Java is distributed because it facilitates users to create distributed
applications in Java.
Multi-threaded
A thread is like a separate program, executing concurrently. We can write
Java programs that deal with many tasks at once by defining multiple
threads.
Dynamic
Java is a dynamic language. It supports the dynamic loading of classes. It
means classes are loaded on demand. It also supports functions from its
native languages, i.e., C and C++.
3|Page
, First Java Program
o class keyword is used to declare a class in Java.
o public keyword is an access modifier that represents visibility. It
means it is visible to all.
o static is a keyword. If we declare any method as static, it is known as
the static method. The core advantage of the static method is that there
is no need to create an object to invoke the static method. The main()
method is executed by the JVM, so it doesn't require creating an object
to invoke the main() method. So, it saves memory.
o void is the return type of the method. It means it doesn't return any
value.
o main represents the starting point of the program.
o String[] args or String args[] is used for command line argument.
o System.out.println() is used to print statement. Here, System is a
class, out is an object of the PrintStream class, println() is a method of
the PrintStream class.
What happens at runtime?
At runtime, the following steps are performed:
4|Page