Skip to content
Saket Khopkar edited this page Jan 11, 2022 · 4 revisions

Welcome to the The-Java-Programming-Repository wiki!

Why java is not 100% Object Oriented Language?

  • In Java, everything is not considered as an Object, Primitive data types are also available. For example: int data type is used for numbers which is not an object type. (Only Integer is object type).
  • All features of OOP language is not fully supported by Java. For example: Multiple Inheritance, Operator Overloading, etc is not supported by Java.
  • Pure OOP Language should satisfy following features:
  1. Encapsulation / Information Hiding
  2. Inheritance
  3. Polymorphism / Dynamic Binding
  4. All pre-defined types should be Objects.
  5. All operations performed by sending messages to Objects (Message Passing)
  6. All user-defined should be Objects.
  • As Java is not supporting some of the features as feature 4 and 5 and some other also, Java is not 100% pure OOP Language.

Why java is truly Object Oriented Language? Explain.

  • Almost everything in Java is an object. All program code and data reside inside classes and objects. Java comes in extensive set of classes, arranged in packages, that we can use in our programs using inheritance. The object model in Java is simple and easy to extend.
  • Java supports following features:
  1. Objects
  2. Classes
  3. Data Abstraction
  4. Encapsulation
  5. Inheritance
  6. Polymorphism
  7. Dynamic Binding
  8. Message Passing
  9. All user-defined data types are Objects.
  • As Java is supporting all these features java is truly OOP Language.

Mathematical Functions in Java:

  • For performing the various mathematical operations the java.lang package contains a math class. Math class contains most commonly used mathematical functions.
  • Syntax of using Math functions: Math.method_name(Parameters);
Method Description
static double abs(double a) Returns an absolute value of the double value
static float abs(float a) Returns an absolute value of the float value
static int abs(int a) Returns an absolute value of the integer value
static long abs(long a) Returns an absolute value of the long value
static double max(double a, double b) Returns an maximum value among two double values
static float max(float a, float b) Returns an maximum value among two float values
static int max(int a, int b) Returns an maximum value among two integer values
static long abs(long a, long b) Returns an maximum value among two long values
static double min(double a, double b) Returns an minimum value among two double values
static float min(float a, float b) Returns an minimum value among two float values
static int min(int a, int b) Returns an minimum value among two integer values
static long min(long a, long b) Returns an minimum value among two long values
static double exp(double a) Returns an Euler number e raised to the
static double pow(double a, double b) Returns an result of first argument raised to the second argument
static double sqrt(double a) Returns an correctly rounded positive square root of a double value
static long round(double a) Returns closest long to the argument
static int round(double a) Returns closest int to the argument