Wednesday, 25 December 2013

List a few major difference between C++ and Java

There are following some difference between C++ and Java:-

What is multithreading ?How does it improve the performance of the Java?

Multithreading means handing multiple tasks simultaneously,like listing to an audio song while downloading a file from a distent computer.Java support multithreading.Java programs can be written to support multithreading. In Java two programes can be run to do different tasks,like to show the GUI graphics to the user and simultaneously read a file from the hard-disk.So it make the application run smoothly,so that the performance will be better.

How java is more secure than other languages?


Java is more secure because of following reasons:-
  • No use of pointer :-
  •             Java do not use the pointers like other languages c,c++.(pointers are variables which holds the memory addresses).These pointers leads to unauthorized access to the memory blocks if some other program get the pointer values,and can change and manipulate the data stored in the systems RAM.But java does not use the pointers,it has its internal mechanism to manage the memory management .Java give the access to the data to the programs which has proper verified authorization.
  • Concept of error handling and exception handling :-
  •           Java provide the exception handling concept which capture series errors and eliminates any risk of crashing the system.Java compiler check all the code lines and check that if there is any line of code that may create error and give warnings to the programmer like "deprecated methods and classes",so that the more effective program can be written by doing changes in the program .It checks the at the time of execution and may create the exception ArrayIndexOutOfBoundExceptionso that these exceptions can be handled without program crash ,and unauthorised memory contents are not accessible and modifiable by any other programs.
  • Strict Data Type Checking:-Java compiler strictly check the data type that is defined to the variables in the program ,so that there unboxing and unboxing operations can not lead to security issues.Java provide wrapper classes to use in place of primitive data types like Integer class to use instead of int data type ,there are many more.
  • Garbage Collector:-Java has its internal garbage collector that automatically deallocate the variables and objects that go out of scope ,so that the and security issue may lead ,and it also effective to put the memory management task in the hand of Garbage Collector ,because the programmer may do mistake in programming logic(like left destruction of objects and pointers)  that may lead to loophole in the security of program.But java is secure in this case.

Friday, 6 December 2013

Why is Java known as platform-neutral language?

Java is known as platform independent because it uses the concept of  generating the byte code of the high level program ,and then run that byte code(intermediate code) on JVM(Java Virtual Machine),now what is JVM,actual JVM is a virtual computer system that run on your original computer system .
   JVM converts the byte code to machine code according to the your original computer's machine architecture(your computer system architecture like x86,ARM etc.).Here is flow how the Java handle your high level program.



      So java compilation is done only once ,after that the byte code can be interpreted on any machine that have JVM.JVM is of different type according to computer system architecture,means for x86 JVM will be different for ARM JVM will be different etc.These are developed by the java vender that is Oracle.This JVM come as a part of JDK(Java Development Kit).
So this compiler and interpreter has make it platform-neutral language.