450+ experts on 30 subjects ready to help you just now

Starting from 3 hours delivery

This essay has been submitted by a student. This is not an example of the work written by professional essay writers. # Mathematical Library Methods

### Introducing java.lang package

### Important classes in java.lang package

### Classes Description

### The Math class

### Java expressions

### Expressions which produce a value

### Expressions which assign a value

### Expressions with no result

- Subject:
**Information Science and Technology** - Category:
**Computer Science** - Essay Topic:
**Application Software**,**Computer Programming** - Pages: 2
- Words: 947
- Published: 10 April 2019
- Downloads: 32

Remember! This is just a sample.

You can get your custom paper by one of our expert writers.

Get custom essay121 writers online

Java is known for its interoperability, portability and the ease with which a programmer can carry out all the tasks. Java also provides reusability for its code. The main reason why programmers prefer java is due to its object-oriented approach that makes it very easy to write programs.

The java.lang package is one amongst the many predefined packages that java has to offer. Packages help in reducing the lines of code and making the programmer’s job easy. The java.lang package consists of all the classes and interfaces that are the building blocks of any java program. It has classes like Object, Threads, String, Math and so on, which make your job easier. Moreover, without importing this package, 90% of your java program is incomplete because it might not understand many aspects of the program during compilation.

The java.lang package consists of all the essential elements of any Java program. The following are the most important classes which are present in the java.lang package:

- Object
- String
- Math
- StringBuffer

NOTE: The java.lang package is the only package in Java that is implicitly used in the program. It means that if you do not mention the syntax for importing the java.lang package, the program will automatically import it during compilation or running the program.

The syntax for importing java.lang package is import java.lang.*;

It is very important to know the basic classes that are the building blocks of Java. Some of these blocks are mentioned in this section for your reference and clear understanding. Just remembering the classes will help you when you are writing the code.

Moreover, this will give you a detailed understanding of the important classes and will help you remember the basic concepts of these classes.

We will understand their application, but let us stick to the basics right now

Here is the table of basic java.lang classes in the following table:

Class Math Math class helps in performing the numeric operations. It provides only static methods. It consists of values for mathematical constant e. It also helps in finding out values for trigonometric functions which is a huge task when it comes to hard code each and every function for solving a trigonometric question through programming.

Class Object As we know, Java follows object-oriented paradigm, it has always been communicating using classes and objects. So, whenever we make a class, object is always a base class for all classes.

Class String Strings are present in all the major applications and considered as the important part of any java application. It is not only string but also some methods like indexOf, length, split, and substring that it offers.

Class StringBuffer This class provides an alternative for String class. String class offers length, split, and substring methods but when it comes to building u strings from two different strings, StringBuffer comes in to picture with his own methods append, toString and insert to name the major ones.

Please note that the method names used in the table above are case sensitive and need to be followed as it is.

In this chapter, we will understand some Mathematical function libraries from the class Math of java.lang package.

The math class consists of all the numerical, static values and fields. It helps us for performing difficult and cumbersome mathematical operations with ease and less lines of code.

There are different math class methods for all types of Mathematical operations from arithmetic to trigonometric, logarithmic to exponential and so on.

The math class of java.lang package will be responsible for providing the static methods to implement math functions, which will help us to perform arithmetic operation smoothly. Not only, arithmetic, also can the trigonometric functions be used from the math class. We will understand the working of each class using a programming example.

Let us learn the Math classes one by one along with the example. We have different types of Math classes divided in the following major classification:

- Trigonometric
- Exponentiation/Root
- Utility
- Rounding

Expressions in Java can be understood as the fundamental concept of writing any complex Java program. Expressions are used to create a new value, but not limited to it. It can also be used to assign a value to a new variable for using it as per the needs. Expressions are built by using the variables, values and function calls.

Expressions are meant to produce a result for most of the time, but that is not true for all the cases. We can classify expressions on the basis of their behavior:

- Expressions which produce a value
- Expressions which assign a value
- Expressions which have no result, because it might be a part of the function call sometime

There are a lot of operators in java from addition, subtraction to division and modulus. The expressions which produce a value are those which use one or all the above operators for producing value.

For example, some arithmetic operators like +, -, *, / , >, < etc.

Examples of expressions that could produce a value are:

3/4

5%6

Assignment is used to assign a value to the variable on the left. Values to be assigned are always written on the right.

int a = 100;

int seconds = 100;

The preceding are the examples of expressions that are used to assign a value.

There are times when the expression is not assigning any value nor does it produce any result. But there might be some result when the operands change.

For example, if we have an expression always produce a side effect:

int product = x *z;

For example, this value does not produce any value for us when we run the program containing the preceding expression. It is executed only for the effect of it. This mostly happens in when you are trying to call the function from some other functions.

Remember: This is just a sample from a fellow student.

Your time is important. Let us write you an essay from scratch

450+ experts on 30 subjects ready to help you just now

Starting from 3 hours delivery

We provide you with original essay samples, perfect formatting and styling

To export a reference to this article please select a referencing style below:

“Mathematical Library Methods.” *GradesFixer*, 10 Apr. 2019, gradesfixer.com/free-essay-examples/mathematical-library-methods/

Mathematical Library Methods [Internet]. GradesFixer. 2019 Apr 10 [cited 2022 Aug 15]. Available from: https://gradesfixer.com/free-essay-examples/mathematical-library-methods/

copy to clipboard

Don't use plagiarized sources. Get your custom essay. Get custom paper