GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.tutorialspoint.com — Java.math.MathContext.hashCode() Method
Selected Reading
Java.math.MathContext.hashCode() MethodDescriptionThe java.math.MathContext.hashCode() returns the hash code for this MathContext. DeclarationFollowing is the declaration for java.math.MathContext.hashCode() method. public int hashCode() OverrideshashCode in class Object. ParametersNA Return ValueThis method returns the hash code for this MathContext. ExceptionNA ExampleThe following example shows the usage of math.MathContext.hashCode() method. package com.tutorialspoint;
import java.math.*;
public class MathContextDemo {
public static void main(String[] args) {
// create 2 MathContext objects
MathContext mc1, mc2;
// assign context settings to mc1, mc2
mc1 = new MathContext(5);
mc2 = new MathContext(20, RoundingMode.UNNECESSARY);
// create 2 int objects
int i1, i2;
// assign hashcode of mc1, mc2 to i1, i2
i1 = mc1.hashCode();
i2 = mc2.hashCode();
String str1 = "Hashcode of mc1 is " + i1;
String str2 = "Hashcode of mc2 is " + i2;
// print i1, i2 values
System.out.println( str1 );
System.out.println( str2 );
}
}
Let us compile and run the above program, this will produce the following result − Hashcode of mc1 is 1802290004 Hashcode of mc2 is -1299934805 java_math_mathcontext.htm
Advertisements
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |