Tuesday, January 22, 2013

Why Java is called secure

There are two things that make Java "more secure" than other language in certain aspects:

    Automatic array bounds checking and the lack of manual memory management make certain classes of programming mistakes that often cause serious security holes (such as buffer overruns) impossible. Most other modern languages share this feature, but C and C++, which were dominant (and still are major) application development languages at the time Java first appeared, do not.
   
    The Security Manager concept makes it relatively easy to run Java applications in a "sandbox" that prevents them from doing any harm to the system they are running on. This played an important part in promoting Java during its early days, since Applets were envisioned as a ubiquitous, safe way to have client-side web applications.

    In addition, the Java language defines different access modifiers that can be assigned to Java classes, methods, and fields, enabling developers to restrict access to their class implementations as appropriate. Specifically, the language defines four distinct access levels: private, protected, public, and, if unspecified, package. The most open access specifier is public access is allowed to anyone. The most restrictive modifier is private access is not allowed outside the particular class in which the private member (a method, for example) is defined. The protected modifier allows access to any subclass, or to other classes within the same package. Package-level access only allows access to classes within the same package.

    A compiler translates Java programs into a machine-independent bytecode representation. A bytecode verifier is invoked to ensure that only legitimate bytecodes are executed in the Java runtime. It checks that the bytecodes conform to the Java Language Specification and do not violate Java language rules or namespace restrictions. The verifier also checks for memory management violations, stack underflows or overflows, and illegal data typecasts. Once bytecodes have been verified, the Java runtime prepares them for execution.

10 comments:

  1. Best explanation I have found on the topic so far.

    ReplyDelete
  2. nice explaination

    ReplyDelete
  3. we can decompile java code then how java is secure..i want to know at the time of decompilation how we can secure our java code?

    ReplyDelete
  4. Thanks for the good explanation

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Because it is with OOPS (object oriented programming) concept. It is really robust and well structured so obviously it's going to be more secured than any other languages.

    ReplyDelete