answersLogoWhite

0


Best Answer

Cat oldCat = new Cat(); Cat newCat = new Cat(); Cat oldCatRef = oldCat;

In the above example, oldCat and oldCatRef are references to the same object. Since they refer to the same object, their hashcodes will be equal.

But oldCat and newCat do not refer to the same object. They are references to two different objects. But they might have the same hashCode based on their implementation. hashCode is simply a method in Object class which you can override.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between reference and hash code in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between a hash set and a linked hash set?

The only difference is that the LinkedHashSet maintains the order of the items added to the Set but HashSet doesn't maintain any order.


What is the difference between hash browns and fancy hash browns?

Not really anything. I've never heard of fancy hash browns but they sound more detailed and have a better taste.


What difference does it make if you remove a period in a hash?

It makes a big difference because if you compared the hash: abcde.fg = hash 1 to abcdefg = hash 3 The results hash 1 and hash 3 are not equal.


What is the difference between AES Rijndael symmetric algorithm encryption and a hash algorithm?

678


What is hash collision?

Hash collision means....2 different keywords having the same hash code. Yes its as simple as that........


What is the difference between a period and a hash symbol in declaring CSS classes?

Period which specifies to a class using (.) or dot operator Where as hash or # specifies to id of a particular attribute of HTML tags


Define hashing and describe briefly including types of hashing and where it is used and advantages and disadvantages of hashing?

Hashing is performed on arbitrary data by a hash function. A hash function is any function that can convert data to either a number or an alphanumeric code. There are possibly as many types of hashing as there are data. How precisely the hash function works depends on what data it is meant to generate a hash code from. Hashing is used for a variety of things. For example, a hash table is a data structure used for storing data in memory. Instead of iterating through the structure to find a specific item, we associate a key (hash code) to a particular item (data). A hash code can be generated from a file or disk image. If the data does not match the code, then the data is assumed to be corrupted. Hashing has the advantage of taking a larger amount of data and representing it as a smaller amount of data (hash code). The code generated is unique to the data it came from. Generating a hash code can take time however, depending on the function and the data. Some hash functions include Bernstein hash, Fowler-Noll-Vo hash, Jenkins hash, MurmurHash, Pearson hashing and Zobrist hashing.


What is the best way of referring to the output of a secure hash function?

The output from a hash function is referred to as the hash value, hash code, hash sum, checksum or just plain "hash" as in "the hash of the file is...". Generally a hash function is presumed to be secure or it wouldn't be used. If a hash is not secure it could be referred to as "worthless" or "false sense of security".


What is the difference between marijuana and hashish?

Hash is weed...Just pretty strong hash is actually made from the tippy top of the marijauna bud, some people consider the small particles that fall into the pollen catcher of a grinder to be hash, but true hash is bought in a medical marijuana dispensary


Is there a difference between Bustelo Instant espresso coffee and bustelo tipo espresso coffee?

Yes, one has cocaine in it. The other has hash.


Does hash harm brain?

Yes ! It is exactly like thc although it can be smoked in different ways such as on a skillet burner with a torch lighter and one may ask what's the difference between smoking hash that way and smoking just regular weed through a pipe or bong...big difference hash is alot more potent and kills about 10x as much brain cells...enjoy !


What is hash on a sound recording?

A hash is a number calculated from the recording by the program that is used to reference a large database in order to make grouping or finding the sound amongst the collection easier.