Let's start our discussion from the features that Java provides.
Features of Java :
1.Simple : Java is a simple programming language. Pointers are not available in
Java.
Java resembles with C,C++ languages.
In Java some features(pointers) of C language are deleted.
Reason: Pointer's lead to confusion for a programmer.
->Pointers may crash a program easily.
->Using pointers harmful programs like virus and hacking programs can be developed.
2. Object Oriented: Java is an object oriented programming language. Using java we can create objects and classes.
Definition of an Object: Any thing that exits in this real world is an Object.
An object will have ‘properties’ and perform some ‘Actions’.
Properties are represented by ‘Variables’ and ‘Actions’ are represented by ‘methods’ (nothing but the functions in C language).
Definition of a Class: A class is a group name that specifies properties and actions for a group of Objects.
A class is a ‘model’ for creating the objects.
Objects are created from a class.
Object does not exist without a class, but a class can exist without any object.
Note: In Java we must use atleast one Class during a program
3. Distributed: Information is distributed on a various computers on a network.
4. Robust: Java programs will not terminate in the middle.
5. Secure: Java enable the construction of virus-free and tamper free systems.
6.Architecture Neutral : Java’s byte code is not machine dependent.
7. Portable : Java programs give same results on all machine unlike
C,C++ program’s. This is the major reason for C and C++ programs being not used on the internet as INTERNET contains different machines with different configurations.
So...what is the
difference between C and Java?
Difference: C is a platform dependent while Java is an platform independent. Now you might be thinking what is platform dependent and independent?Try to compile a C program that has been developed on your computer and also try to recompile it on your friends computer. You cannot do that because,
C is a platform dependent language but a Java program developed on your machine can be run on your friends machine because
Java is platform independent and this is the reason that
Java applications are being used on the internet.
In the next post we will see some more features of Java. Thank You!