Program to understand similarity between array and object in java.
Answers
Answered by
3
Answer:
class Test
{
public static void main (String[] args)
{
int arr1[] = {1, 2, 3};
int arr2[] = {1, 2, 3};
if (arr1 == arr2) // Same as arr1.equals(arr2)
System.out.println("Same");
else
System.out.println("Not same");
}
}
Answered by
1
Object − Objects have states and behaviours. Example: A dog has states - color, name, breed as well as behaviours.
Similar questions
Math,
3 months ago
Math,
3 months ago
Science,
6 months ago
Science,
6 months ago
Political Science,
10 months ago