Tutorialspoint

What are the other uses of toothpaste, apart from cleaning teeth?

Om Sharma
Answered 19h 26m ago

It’s true, a toothpaste plays a significant role in keeping your teeth white, bright and prevents cavities. Apart from these benefits, a toothpaste can do wonders for you as this cream can be used to deal with a number of daily troubles. Let's have a roundMedical and Curing UsesGet Relief ... Read More

Apply Ternary operator on double value in Java

Samual Sam
Answered 19h 30m ago

The ternary operator is also known as the conditional operator. This operator consists of three operands and is used to evaluate Boolean expressions.Let’s say we have the following two double values.double val1 = 20.0; double val2 = 3.7;Now, let us use the ternary operator to check for the first value.System.out.println(val1 ... Read More

Compare Two Java double arrays

karthikeya Boyini
Answered 19h 39m ago

To compare two Java double arrays, use the Arrays.equals() method. The following are our double arrays.double[] arr1 = new double[] { 1.3, 7.2, 4.2 }; double[] arr2 = new double[] { 1.3, 7.2, 4.2 }; double[] arr3 = new double[] { 2.8, 5.3, 9.8 }; double[] arr4 = new double[] ... Read More

Java Program to convert Double into String using toString() method of Double class

Samual Sam
Answered 19h 49m ago

Let us first declare a Double −Double ob = new Double(99.12);Use the toString() method to convert Double into String.String res = ob.toString();The following is the complete example.Example Live Demopublic class Demo {    public static void main(String args[]) {       Double ob = new Double(99.12);       String res = ob.toString();       System.out.println(res); } }Output99.12Read More

Convert a String to a double type number in Java

karthikeya Boyini
Answered 19h 53m ago

To convert a String to a double type number in Java, use the Double.parseDouble() method.Here is our string.String str = "699.7e130";Let us now convert the above string to double.double val = Double.parseDouble(str);Example Live Demopublic class Demo { public static void main(String args[]) { String str = "699.7e130"; ... Read More

Java Program to convert String to Double

Sai Subramanyam
Answered 20h 2m ago

To convert String to Double in Java, you can use the following three examples. Two of them are using in-built methods parseDouble() and valueOf(). However, one of the method isn’t using a method.Let us work through them one by one.The following is an example to convert String to Double without ... Read More

Java Program to convert Double to numeric primitive data types

Samual Sam
Answered 1d 18h ago

Let’s say we have Double object here. Double obj = new Double("39.45"); Now, if we want to convert this Double to short primitive data type. For that, use the in-built shortValue() method. // converting to short primitive types short shortObj = obj.shortValue(); System.out.println(shortObj); In the same ... Read More

Trigonometric methods in Java

karthikeya Boyini
Answered 1d 18h ago

The java.lang.Math class contains methods for performing basic numeric operations such as the trigonometry, logarithm, etc. The following are some of the methods. Sr.No Methods & Description 1 static double abs(double a) This method returns the absolute value of a double value. 2 static ... Read More

Format double type in Java

Samual Sam
Answered 1d 18h ago

Let’s say we have the following three values − double val1 = 15.546; double val2 = 25.87; double val3 = Math.PI; Let us now format these double-type numbers. Firstly, we are formatting Euler’s number with Math.exp(). After that, we have also evaluated log. The %.3f you can see ... Read More

Java Double compare example

karthikeya Boyini
Answered 1d 18h ago

To compare Double in Java, use the following methods − Method 1: compareTo() method in Java The java.lang.Double.compareTo() method compares two Double objects. Example Live Demo import java.lang.*; public class Demo { public static void main(String args[]) { Double ... Read More

Convert double value to string in Java

Samual Sam
Answered 1d 18h ago

To convert double value to string, use the toString() method in Java. The method represents a value in string. Let’s say the following is our double to be converted. double doubleVal = 333.24; Now, convert it to string. String str = Double.toString(doubleVal); The following is the ... Read More

Double isNaN() method in Java

karthikeya Boyini
Answered 1d 18h ago

The java.lang.Double.isNan() method returns true if the specified number is a Not-a-Number (NaN) value, false otherwise. Let’s say the following are our Double values. Double val1 = new Double(3/0.); Double val2 = new Double(0/0.); Now, we will use the isNan() method to check whether the number is a ... Read More

Double isInfinite() method in Java

Samual Sam
Answered 1d 18h ago

The Double isInfinite() method returns true if this Double value is infinitely large in magnitude, false otherwise. Let’s say we have the following Double values. Double val1 = new Double(3/0.); Double val2 = new Double(0/0.); Use the isInfinite() method now. The return value is a boolean. val1.isInfinite(); ... Read More

Convert double primitive type to a Double object in Java

karthikeya Boyini
Answered 1d 18h ago

To convert double primitive type to a Double object, you need to use Double constructor. Let’s say the following is our double primitive. // double primitive double val = 23.78; To convert it to a Double object, use Double constructor. // Double object Double ob = new ... Read More

Format floating point number in Java

Samual Sam
Answered 1d 19h ago

Let’s say we have the following two values. double val1 = 20.932; double val2 = 11.67; Let us now format these floating-point numbers. Firstly, we are formatting euler’s number withMath.exp(). After that, we have also evaluated log. The %.3f you can see here is what we used for ... Read More

Previous 1 ... 4 5 6 7 8 9 10 ... 920 Next
Advertisements
Loading...
Unanswered Questions View All