advanced oop
advanced oop
BENEFITS OF OOP:
Oop offers several benefits to both the program designer and the user. Object-oriented
contributes to the solution of many problems associated with the development and quality of
software products.
The principal advantages are:
1. Through inheritance we can eliminate redundant code and extend the use of existing
classes.
2. We can build programs from the standard working modules that communicate with one
another, rather than having to start writing the code from scratch. This leads to saving of
development time and higher productivity.
3. This principle of data hiding helps the programmer to build secure programs that can’t
be invaded by code in other parts of the program.
4. It is possible to have multiple instances of an object to co-exist without any
interference.
5. It is easy to partition the work in a project based on objects.
6. Object-oriented systems can be easily upgraded from small to large systems.
7. Message passing techniques for communication between objects makes the interface
description with external systems much simpler.
8. Software complexity can be easily managed.
APPLICATION OF OOP:
The most popular application of oops up to now, has been in the area of user interface
design such as windows. There are hundreds of windowing systems developed using oop
techniques.
Real business systems are often much more complex and contain many more objects
with complicated attributes and methods. Oop is useful in this type of applications because it
can simplify a complex problem. The promising areas for application of oop includes.
Class Definition
A Java program may contain several class definitions, classes are an essential part of any Java
program. It defines the information about the user-defined classes in a program.
A class is a collection of variables and methods that operate on the fields. Every program in Java
will have at least one class with the main method.
System.out.println();
The statement is used to print the output on the screen where the system is a predefined class, out
is an object of the PrintWriter class. The method println prints the text on the screen with a new
line. All Java statements end with a semicolon.
Java Identifiers
All Java components require names. Names used for classes, variables, and methods are
called identifiers.
In Java, there are several points to remember about identifiers. They are as follows −
All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an
underscore (_).
After the first character, identifiers can have any combination of characters.
A key word cannot be used as an identifier.
Most importantly, identifiers are case sensitive.
Examples of legal identifiers: age, $salary, _value, __1_value.
Examples of illegal identifiers: 123abc, -salary.