class Data {
public int value;
public Data(int value) {
this.value = value;
}
}
String ab = "ab", c = "c";
boolean[] equality = new boolean[] {
// Which of the following are true / false?
"abc" == "abc",
"abc" == "ab" + "c",
"abc" == ab + c,
123 == 123,
new Data(123) == new Data(123)
};
for (boolean equal: equality) {
System.out.println(equal);
}
using System;
public class Program
{
class Data {
public int value { get; set; }
public Data(int value) { this.value = value; }
}
public static void Main()
{
String ab = "ab";
String c = "c";
bool[] equality = new bool[] {
"abc" == "abc",
"abc" == "ab" + "c",
"abc" == ab + c,
123 == 123,
new Data(123) == new Data(123)
};
foreach (bool equal in equality) {
Console.WriteLine(equal);
}
}
}