Question: Predict the output of the given code. package com.infy.demo; record Policy ( int policyNumber, String policyName, long duration, double interestRate ) { } public class

Predict the output of the given code.
package com.infy.demo;
record Policy(int policyNumber, String policyName, long duration, double interestRate){
}
public class DemoClass {
public static void main(String[] args){
Policy policy1= new Policy(100, "DummyPolicy", 60,7.2f);
Policy policy2= new Policy(100, "DummyPolicy", 60,7.2);
System.out.println(policy1.equals(policy2)+""+(policy1== policy2)+""
(policy1.hashCode()== policy2.hashCode()));
}
}
false true false
false false false
true false true
true false false
Predict the output of the given code. package

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!