Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Format Specifier for Hash Code in Java
Format specifier for Hash Code us %h.
Firstly, create a new object for Formatter and Calendar −
Formatter f = new Formatter(); Calendar c = Calendar.getInstance();
For hash code −
f.format("%h", c)
The following is an example that finds the hash code −
Example
import java.util.Calendar;
import java.util.Formatter;
public class Demo {
public static void main(String args[]) {
Formatter f = new Formatter();
Calendar c = Calendar.getInstance();
System.out.println("Hash Code: "+f.format("%h", c));
}
}
Output
Hash Code: 4b899958
Advertisements
