Saturday, 4 May 2013

Why Java is Secure and Portable ?




The answer is
  BYTECODE.!

Bytecode it the key that makes Java language most secure and Portable.


When you compile your java program then on successful compilation , java compiler (javac) generates a class file with .class extension which contains the Bytecodes of your java program. Now the Bytecodes which are generated are secure and they can be run on any machine (portable) which has JVM.


No doubt Java is Platform Independent, but Java is JVM dependent.!
Actually , JVM is an interpreter for Bytecode.
The details of the JVM will differ from platform to platform, but all interpret the same Java Bytecode according to machine/platform.

The Bytecode which are generated by the compiler will be tested by the JVM on the execution of the program or we can say every Java Program is under the control of the JVM which checks the code on the runtime many times for viruses and any malicious.

The Bytecode generated by the compiler are also supported on any machine which has the JVM which makes Java a platform independent language.



What happens if Java Program were not compiled with Bytecodes?

If the Java Program were compile to native code (other than java language) , than different versions of the same program would have to exist for each type of CPU connected to the Internet. Thus, the interpretation of the bytecode is the easiest way to create truly portable programs.



Can Interpretation of Bytecodes makes the Execution Slower?

The answer is NO.!
Since, many old programming languages  like C, C++ etc. only compiled (whole code conversion to machine code) or interpret (line by line conversion) the code on execution but this is not the case with Java language which first compile the source program to Bytecode and than interpret the code on execution. Now this interpretation of the Bytecode is very fast and which makes the Java is much faster language than any other.

These are the reasons which makes Java the most Secure and Portable language than any other language.

19 comments :

  1. Hello Tarun, Is there any other points which makes java more secure ?

    ReplyDelete
    Replies
    1. Hello Badal, there are many other features too which makes java the most secure language than any other language yet but bytecodes is the main reason behind the java security.
      other security features which you may have to take are:
      1. Objects and methods declared as final cannot be changed or overridden.
      2. Array Bounds are checked for all array accesses.
      etc.

      Delete
  2. how java is secure from virus?? do u know??

    ReplyDelete
    Replies
    1. Java is secure language it consists of a secure coding when u write a progrma in java you will give the code to a other person.The hardware which make with the help of java are secure hardware .As most hardware is made up with help of c/c++ and they must be hack because there operating system doesnot consist of security and java program consist of security in opratin system

      Delete
  3. java byte code can be de-interpreted into source code ?

    ReplyDelete
  4. i read ur post.it very informative.today i learn the why java language is secure

    ReplyDelete
  5. Hi, the website contains the great knowledge. It is very worthy. And it covers all the modules in Java Programming Language. Anyway, thank you for your information.

    ReplyDelete
  6. So why is C++ or even C still more faster than Java itself with the same specification machine and code task? :p

    ReplyDelete
  7. Nice article & Thanks for sharing. Java is a very powerful programming language that is open source and based on OOP concept. I read one more article were i learn some more updates http://crbtech.in/Java-Training/makes-java-portable-programming-languages-like-c/

    ReplyDelete
  8. Yes java is secured and portable. Basically its the oops concept which make it more secured and portable. Thanks for sharing.

    ReplyDelete
  9. Thanks for sharing this good blog.It's amazing blogJava Online Course

    ReplyDelete
  10. That'sthe motive selling you acceptable study prior to designing. It is additionally doable to put in writing much better placing on this. Software Design

    ReplyDelete
  11. Great blog The content is informative and engaging. The author's writing style is captivating. Visit my website to get best Information About Salesforce Marketing Cloud Training in Noida and mention Below Technologies.

    Salesforce Marketing Cloud Training in Noida

    ReplyDelete
  12. Appreciate the insightful information. This simplified explanation of Java programming is student-friendly and beneficial. Java's rapid popularity is due to its demand in Artificial Intelligence, Machine Learning, Chat GPT, etc., solidifying its significant role in the IT field. Opting for a career in Full Stack Java is a favorable choice. Full Stack Development: Guide to Building Modern Web Applications

    ReplyDelete