String w1 ="Sarat";
String w2 ="Sarat";
String w3 = new String("Sarat");
System.out.println(w1.hashCode()); //3254818
System.out.println(w2.hashCode()); //3254818
System.out.println(w3.hashCode()); //3254818
System.out.println(System.identityHashCode(w1)); //prints 705927765
System.out.println(System.identityHashCode(w2)); //prints 705927765
System.out.println(System.identityHashCode(w3)); //prints 366712642
if(w1==w2) // (705927765==705927765)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
//prints true
if(w2==w3) // (705927765==366712642)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
//prints false
if(w2.equals(w3)) // (Content of 705927765== Content of 366712642)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
//prints true
Вы забыли цитаты:
echo "<tr>\n
<td align='right'><b>Location</b></td>
<td><input name='student_location' type='text' size='25' style='font-weight: 700' value=\"$location\"></td>
</tr>";
Без кавычек будет отмечено первое слово, другие будут интерпретироваться как неправильные атрибуты.
Вы должны поместить свои одиночные кавычки вокруг него, чтобы сделать его допустимым атрибутом. HTML создается как value=North Campus
, который интерпретируется как value="North"
и некоторый атрибут Campus
, который не имеет значения. Используйте value='$location'
.
вам нужно процитировать его, вырвав «
echo "<tr>\n
<td align='right'><b>Location</b></td>
<td><input name='student_location' type='text' size='25' style='font-weight: 700' value=\"$location\"></td>
</tr>";