-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Saket Khopkar edited this page Jan 11, 2022
·
4 revisions
Welcome to the The-Java-Programming-Repository wiki!
- 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:
- Encapsulation / Information Hiding
- Inheritance
- Polymorphism / Dynamic Binding
- All pre-defined types should be Objects.
- All operations performed by sending messages to Objects (Message Passing)
- 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.
- 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:
- Objects
- Classes
- Data Abstraction
- Encapsulation
- Inheritance
- Polymorphism
- Dynamic Binding
- Message Passing
- All user-defined data types are Objects.
- As Java is supporting all these features java is truly OOP Language.
- 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 |