Sunday, 25 June 2017

Features of Java

Features of any programming language is nothing but the service or basic facilities provided by the language to the programmers. The java language provides the following features.



Simple:-

  • Looks familiar to existing programmers: related to C and C++:
  • Omits many rarely used, poorly understood, confusing features of C++, like operator overloading, multiple inheritance, automatic coercions, etc.
  • Contains no goto statement, but break and continue
  • Has no header files and eliminated C preprocessor
  • Eliminates much redundancy (e.g. no structs, unions, or functions)
  • has no pointers
  • Added features to simplify:
  • Garbage collection, so the programmer won't have to worry about storage management, which leads to fewer bugs.
  • A rich predefined class library



Object-Oriented:-

Java is an object-oriented language, which means that you focus on the data in your application and methods that manipulate that data, rather than thinking strictly in terms of procedures.
In an object-oriented system, a class is a collection of data and methods that operate on that data. Taken together, the data and methods describe the state and behavior of an object. Classes are arranged in a hierarchy, so that a subclass can inherit behavior from its superclass.
Java comes with an extensive set of classes, arranged in packages, that you can use in your programs.

Portable:-

java goes further than just being architecture-neutral:

  • no "implementation dependent" notes in the spec (arithmetic and evaluation order)
  • standard libraries hide system differences
  • the Java environment itself is also portable: the portability boundary is POSIX compliant

  •  Platform Independent:-

    A platform is the hardware or software environment in which a program runs.
    There are two types of platforms software-based and hardware-based. Java provides software-based platform.
    The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on the top of other hardware-based platforms. It has two components:
    1. Runtime Environment
    2. API(Application Programming Interface)
    Java code can be run on multiple platforms e.g. Windows, Linux, Sun Solaris, Mac/OS etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms i.e. Write Once and Run Anywhere(WORA).

    Secured:-

    Security is an important concern, since Java is meant to be used in networked environments. Without some assurance of security, you certainly wouldn't want to download an applet from a random site on the net and let it run on your computer. Java's memory allocation model is one of its main defenses against malicious code (e.g can't cast integers to pointers, so can't forge access). Furthermore:

  • access restrictions are enforced (public, private)
  • byte codes are verified, which copes with the threat of a hostile compiler
  • Robust:-

    Java has been designed for writing highly reliable or robust software:

  • language restrictions (e.g. no pointer arithmetic and real arrays) to make it impossible for                     applications to smash memory (e.g overwriting memory and corrupting data)
  • Java does automatic garbage collection, which prevents memory leaks
  • extensive compile-time checking so bugs can be found early; this is repeated at runtime for                  flexibilty and to check consistency

  • Architectural neutral:-



  • compiler generates bytecodes, which have nothing to do with a particular computer architecture
  • easy to interpret on any machine
  • Dynamic:-

    Java was designed to adapt to an evolving environment:


  • Even after binaries have been released, they can adapt to a changing environment
  • Java loads in classes as they are needed, even from across the network
  • It defers many decisions (like object layout) to runtime, which solves many of the version                    problems that C++ has
  • Dynamic linking is the only kind there is
  • Interpreted:-

    It is one of the highly interpreted programming languages.

    High performance:-

    Java is faster than traditional interpretation since byte code is "close" to native code still somewhat slower than a compiled language (e.g., C++)

    Multi-threaded:-

    A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it doesn't occupy memory for each thread. It shares a common memory area. Threads are important for multi-media, Web applications etc.

    Distributed:-

    We can create distributed applications in java. RMI and EJB are used for creating distributed applications. We may access files by calling the methods from any machine on the internet.

    0 comments:

    Post a Comment

    test

    Manual Testing

    Popular Posts