Originally posted by Priya Balaraman:
Right. Starting off with the 1.4 seems correct. Bought Khalid mughal and starting off preparation.
Originally posted by bhavesh bhanushali:
the following code will reflect some light on the issue
public class ByteToString
{
public static void main ( String args[] )
{
Byte b1 = new Byte ( "127" ) ;
if ( b1.toString ( ) == b1.toString ( ) ) // ( 1 )
System.out.println ( " Yes the == returns true " ) ;
else
System.out.println ( " Yes the == returns false " ) ;
if ( b1.toString ( ).equals ( b1.toString ( ) ) ) // ( 2 )
System.out.println ( " Yes the == returns true " ) ;
else
System.out.println ( " Yes the == returns false " ) ;
}
}
---------------------------------------------------------------------------
at ( 1 ) , the addresses are compared which are different for b1.toString ( ) and b1.toString .
whereas at ( 2 ) the values that the strings have are compared which are equal
so , in a sense the values are the same but the addressses are different
others please shed some light on the issue
regards ,
Bhavesh
Originally posted by jigar parekh:
I found one strange question,
Options :
a) true true true true true true
b) true false true false true false
c) true true false false false false
d) true false true true false false
e) true true false true false false
f) false false false false false false
g) compile-time error
Correct answer is : D
but according to me answer should be F bcoz string is imutable so it should return new instance of string object.
???
Originally posted by Henrique Sousa:
Originally posted by Ben Souther:
Originally posted by Ben Souther:
Just check to see if the object stored in session is null.
If so, either redirect or forward to the login page.