equals tag

4 questions


2 answers
112 views
0
I am using String.equals() sentence in If conditional statement, is there any method or method to reduce it further?

Currently, I am writing an if sentence as below. By the way, I want to compare the word WORDS with the corresponding objects and the equivalents of a specific word, is there a way to make it simpler?O...

1 years ago

1 answers
73 views
0
What should be considered when overriding equals() and hashCode() in Java?

What should be considered when overriding equals() and hashCode()?


1 answers
102 views
0
Can you compare arrays of different lengths?

public static void main(String[] args) { int[] array1 = new int[4]; int[] array2 = new int[7];Arrays.equals(array1,array2);}I don't get an error even if I do this, but I'm not sure if I compared it pr...

1 years ago

1 answers
105 views
0
Overriding rules for equal's method in Java

I'm studying Java with googling, and I saw a post saying that it's better to use the same as you inherited instead of overriding the equals. But if you want to override the equals, I told you to only ...

1 years ago

© 2024 OneMinuteCode. All rights reserved.