Q 1). Java has many features including Object Oriented,

Added on - 20 Sep 2019

  • 6

    pages

  • 1044

    words

  • 48

    views

  • 0

    downloads

Showing pages 3 of 6
Q 1)Java has many features including Object Oriented, Platform Independent, Robust,Interpreted, and Multi-threaded. Discuss the principles, characteristics and features ofProgramming in Java?Ans:Characteristics and Features of Java1.Simple:According to Sun, Java language is simple because its syntax based on C++. If aprogrammer is familiar with C++, then it is easy to learn quicker Java language. Someconcepts removed from this language that makes developer confused, for example,explicit pointers, operator overloading, etc. It also eliminates the greatest headache forthe developer, and that is removing the unreferenced objects. Java provides AutomaticGarbage Collection.2.Object- oriented:Java is an object-oriented programming language. By using thislanguage, we can easily organize our software as a combination of different types ofobjects. Each object has own data and behavior. This methodology simplifies softwaredevelopment and maintenance by providing some set of rules or principles.3.Platform Independent:As we know platform belongs to hardware or softwareenvironment in which a program runs. Java provides the software-based platform thatruns on the top of other hardware-based platforms. Java has two important components:a)Runtime Environmentb)API (Application Programming Interface)
Note: Java code can run on any platform for example: Windows, Linux, Sun Solaris,Mac/OS, etc.4.Secured: Java is secured language because there are no explicit pointer and Javaprograms run inside virtual machine sandbox. Here is the diagram describes the apparentdifference
Classloader:It separates the package for the classes of the local file system from thosefiles that imported from network sources.Bytecode Verifier:It checks the fragments of code for illegal code that can violateaccess right to objects.Security Manager:It determines what type of resources a class can access such asreading and writing to the local disk.5.Robust:Java uses proper memory management. Java eliminates pointer concept that wasa cause of weak security. Java provides automatic garbage collection. There are exceptionhandling and type checking mechanism in Java. All these make Java robust.6.Portable:We can run the Java bytecode on any platform.7.Multi-threaded:A thread is a part of a program which cannot break further. Java basedon multithreading concept. Threads shares common memory. They do not need separatememory to run. They run concurrently. It reduces the execution time, and it increases theperformance.Principles of Java LanguageThere are three essential principles.1.Encapsulation:Encapsulation wraps the attributes and the behavior. Encapsulationprovides security by covering things in the single unit. Encapsulation preventsunauthorized access to a class from outsiders. For example: a class combines attributesand methods in a single unit.2.Inheritance:The main advantage of Inheritance of code re-usability. A class inherits oruses the features of already exists class; this is called inheritance (reusing the code).There are two types of classes. One is the parent or super (this already exists, or we can