oracle242004 Posted May 7, 2015 Report Posted May 7, 2015 evaraina hashcode and equals gurunchi cheputara.inka what is meant by synchronization. And also difference between throw and throws?
compose Posted May 7, 2015 Report Posted May 7, 2015 throws is used when we want to catch ask exception at class level instead of having multiple try- catch blocks
compose Posted May 7, 2015 Report Posted May 7, 2015 throw is used for the capability to be able to throw custom exceptions in our code
kiran karthik Posted May 7, 2015 Report Posted May 7, 2015 1. hashcode n equals Assume you have some buckets and each bucket contains a list of names if someone asks you to find a bucket which contains a name some "xyz" for this we need to do 2 things 1. first we need to find the right bucket 2, compare the name "xyz" with others So hashcode will help you to find the right bucket. and equals method used to compare "xyz" with the names in the bucket and returns true if it equals
Pichkaari Posted May 7, 2015 Report Posted May 7, 2015 Go check this link.. You will get to know .. https://www.youtube.com/playlist?list=PLYPjPMiw3_YsVockWfuuhoP86YPDUXp4f 1
oracle242004 Posted May 7, 2015 Author Report Posted May 7, 2015 Bhaiyya got ur bucket theme can you explain now in java
compose Posted May 7, 2015 Report Posted May 7, 2015 1. hashcode n equals Assume you have some buckets and each bucket contains a list of names if someone asks you to find a bucket which contains a name some "xyz" for this we need to do 2 things 1. first we need to find the right bucket 2, compare the name "xyz" with others So hashcode will help you to find the right bucket. and equals method used to compare "xyz" with the names in the bucket and returns true if it equals ()>> ()>> ()>> ()>>
kiran karthik Posted May 7, 2015 Report Posted May 7, 2015 we have got a scenario like deposit, check balance, withdrawal assume the account is mutual(used by multiple users A, B) Assume the current amount is 100$ A deposits money - 100$ B withdraws money- 100$ A checks balance - 100$ will be shown in the statement assume if all the operations are done at a time, it will be a collapse user 'A' will be shocked, because these operations can be done parallelly But if you synchronize the deposit(), withdraw(), checkbalance() only one user can be accessed at a time Once A finishes his job, B will b allowed to withdraw
Recommended Posts