Skip to main content

Characteristics of Java OR Java Buzzwords (Part 1)

>

Java Properties:

The Java programming language is a high-level language that can be characterized by all the following buzzwords:
  1. Simple:
    • Java is designed for easy and effective programming. If the concepts of object oriented programming are understood properly, the implementation of programs in Java becomes easy.
    • Because Java inherits the syntax of C/C++ and many object-oriented features of C++, it is easy and simple to program.
  2. Object oriented:
    • Java follows all the concepts of object oriented programming which includes three basic OOP features:
      1. Encapsulation:
        • Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.
        • Encapsulation is as a protective wrapper that prevents the code and data from being arbitrarily accessed by other code defined outside the wrapper. Access to the code and data inside the wrapper is tightly controlled through a well-defined interface or class.
        • In java, encapsulation is supported by concept of classes and objects. A class defines the structure and behavior (data and code) that will be shared by a set of objects. Each object of a given class contains the structure and behavior defined by the class, as if it were stamped out by a mold in the shape of the class. For this reason, objects are referred to as instances of a class.
        • For example: class a {
          /* body of class a. the body contains methods and variables that are encapsulated by the wrapper ‘class’. These class members can be accessed only when an object is referenced to class a. */
          }
        • Each method or variable in a class may be marked private or public. The public interface of a class represents everything that external users of the class need to know, or may know. The private methods and data can only be accessed by code that is a member of the class. Therefore, any other code that is not a member of the class cannot access a private method or variable.
      2. Inheritance:
        • Inheritance is the process by which one object acquires the properties of another object.
        • Inheritance is important because it allows extension and reuse of the existing code, without having to repeat or rewrite the code from search.
        • It involves the creation of new classes known as derived classes from the existing base classes. The new derived class inherits the members of the base class and also adds its own methods and variables.
        • For example, in a banking system, the class student_customer can be derived from customer_main class. Eg.:
          class student_customer extends customer_main {
          // this is the derived class.
          }
      3. Data Abstraction:
        • Abstraction is a design technique that focuses on the essential attributes and behavior. It provides a named collection of essential attributes and behavior.
        • Data abstraction is a process of abstracting common features from objects and procedures and creating a single interface to perform multiple tasks.
        • For example, if the function of ‘print’ is used in many classes, the programmer may ‘abstract’ that function, creating a separate class that handles different types of printing.
        • Encapsulation and abstraction are closely related to each other. Encapsulation is a concept embedded in abstraction. A good abstraction provides:
          o Meaningful way of naming the attributes and methods.
          o Minimum features
          o Complete details.
      4. d. Polymorphism:
        • Polymorphism is a feature that allows one interface or feature to be implemented in various different ways. It is the ability of different objects to respond to the same message in different ways.
        • Polymorphism is expressed as “one interface, multiple methods”. It allows a single name or operator to be associated with different operations, depending upon type of data it has passed.
        • For example, the operator ‘+’ can be used to add two integer variables if it is used with integer types, but it functions as a concatenation operator if used with strings.
          Example:
          System.out.println(“this is” + “java”);
          // will return the string concatenated output. “this is java”
          System.out.println(5+2);
          // will return the addition of numbers 5 and 2= 7
Characteristics of Java PART 2 is HERE
Characteristics of Java PART 3 is HERE

Comments

Relevant to YOU:

Popular posts from this blog

ASCII Code in Java (Part 1)

> The ASCII Code: (Part 1) ASCII stands for "American Standard Code for Information Interchange". As you may remember (Grade 9), computers only work with HIGH(1) and LOW(0) electrical states, known as bits, with correspond to mathematical Base 2 numbers. That is, computers only understand binary language. ASCII codes represent text (or other things) in computers. Assume that you are working with MS Word, or PPT or any other tool that uses text based inputs from user. You need to type a sentence that computer is not aware of. ASCII codes help to exchange this information between user and computer. When you type a character, it is converted into ASCII code first and then into Binary, which makes the computer understand what is to be typed. Hence every key on the keyboard has a specific ASCII code which is used to make the computer understand our language. If you press 4 from keyboard, then keyboard send the value 100 (value equival...

Characteristics of Java OR Java Buzzwords (Part 2)

> Java Properties: (Part 2) Robust: Java is robust because it is more reliable. It ensures the reliability by providing early checking for possible errors. It eliminates error causing constructs such as pointers. Java restricts the programmers in a few key areas, to force them to find mistakes early in program development. At the same time, Java frees from having to worry about many of the most common causes of programming errors. Because Java is a strictly typed language, it checks the code at compile time. However, it also checks your code at run time. Consider two main reasons of program failure: Memory management mistakes and Mishandled exceptional conditions (run time errors). Memory management is difficult and tedious in c/c++, the programmers have to manually allocate and free memory. This sometimes leads to problems, because programmers will either forget to free memory that has been previously allocated or, worse, try to ...