Why Java is more secure | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why Java is more secure

Why Java is more secure

13th Dec 2016, 5:13 PM
Sagar Mamidala
Sagar Mamidala - avatar
2 Answers
+ 1
Compared to lower level languages like c and c++, java does a lot to control memory for you. C and cpp use pointers. These pointers can point ANYWHERE in memory. If you misuse them it can point and edit the wrong memory. Java does not support pointers so you do not need to worry about memory. Java also does boundry checks on arrays while c and maybe cpp do not. In java: int array[] = {1}; array[-1]; This would cause an array out if bounds error... In c/cpp(same code): int array[] = {1}; array[-1]; This still works and would grab some junk data. Java is a lot more strict and therefore secure.
14th Dec 2016, 1:13 AM
Gabe Maxfield
Gabe Maxfield - avatar
+ 1
according to me, Java runs in Java virtual machine not directly in os and C and CPP directly runs inside OS so Java is more secure
14th Dec 2016, 2:30 AM
Sagar Mamidala
Sagar Mamidala - avatar