R
Razvan
Hi!
The following code prints 'equal' on my system (jdk 1.4):
public class CDummy
{
public static void main(String args[])
{
System.out.println("CDummy.");
String temp = "unique";
if (temp == CSomeDummy.s1) System.out.println("equal");
}
}
class CSomeDummy
{
static String s1 = "unique";
}
Is this behaviour dictated by specifications ? Is it possible that
temp and CSomeDummy.s1 references will not be equal because the string
are in different classes ? Perhaps this is implementation dependent.
Regards,
Razvan
The following code prints 'equal' on my system (jdk 1.4):
public class CDummy
{
public static void main(String args[])
{
System.out.println("CDummy.");
String temp = "unique";
if (temp == CSomeDummy.s1) System.out.println("equal");
}
}
class CSomeDummy
{
static String s1 = "unique";
}
Is this behaviour dictated by specifications ? Is it possible that
temp and CSomeDummy.s1 references will not be equal because the string
are in different classes ? Perhaps this is implementation dependent.
Regards,
Razvan