Friday, 21 April 2017

Why is Java more safe than C++?

It's one of the questions we think everytime, whenever we are asked about it. So, the simple answer that is due to pointers.
Now how is this this the shortest Answer? Think about it that what pointers do? They create loop holes in a language.
But How?
A  pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address.(This definition is from Wikipedia).

Now My own definition: A pointer is an object which points to the value and address of the other object in the Program. We can change the value of that variable through pointer.(Can even find out the address).

So by having the ability to point to the other variable it decreases the security level in Programming Languages.  So Java doesn't have Pointers. That's how it becomes More safe because everything is running inside the JVM. 

No comments:

Post a Comment