Can someone pls. explain this to me? class A { private int[] val; private int hash; public int hashCode() { int h = hash; if (h == 0) { int len = val.length; for (int i = 0; i < len; i++) { h = 31*h + val[i]; } hash = h; } return h; } // The equals method has been omitted for clarity. A (int[] val) {this.val = (int[])val.clone();} public static void main (String[] args) { A a = new A(new int[]{1,2,3}); System.out.print(a.hashCode()); }} What is the result?
Which are valid? (1) Math.max(1,4) (2) Math.max(2.3,5) (3) Math.max(1,32,2) (4) Math.max(-1.8,-4.2f) my answer is (1) only.but the answer is 1,2,3 Can someone explain why?
Suspended is depracated so dont think of that option.Then finished meians it cant start again.Then comes the 2 in runnable states .The priority is from 1-10 in increasing order,so the answer is obviously 3. Thanks Rashu
Hello I am preparing for SCJP for last 1 month.I have seen 2-3 books but still have a confusion.When there are multiple answers for a question in the exam like 3 of 5 or so ,is it metioned in the question that choose 3 correct answers? Thanks Rashu Gulati
I think that the left operand can be promoted to long or int. Also i know something abt. <<,<<< & >> operators but cant really figure out a way to solve when some negative numbers come into picture. Thanks
Hi I need to know the answer of : -42>>-4 and also a easy way to find it out. Please help me Also Can shift operators be applied to float,double. Thanks Rashu Gulati
Hello All I am new to this place.Planning to give certification sometime soon,so while going through some site ,read a lot abt. the discussion forums here.Hope to get good response from all.Lookling forward to learn a lot. Thanks
Hello I joined the forum today only .Hope my answer helps you out.All you need to do is to have a web.xml file in /mainwebapp/WEB-INF which will look something like this. <servlet> <servlet-name> AssignmentCookie </servlet-name> <servlet-class> AssignmentCookie </servlet-class> </servlet> <servlet-mapping> <servlet-name> AssignmentCookie </servlet-name> <url-pattern> AssignmentCookie </url-pattern> </servlet-mapping> </web-app> All u have to do is to replace the assignmentCookie by your file name. Hope it helps you.