|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

05-09-2008, 07:38 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
|
|
Yep, normally called as unclosed character literal. 
So what is the different of,
System.out.println((String)"Java");
and,
System.out.println("Java");
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best? Vote Now
|
|

05-09-2008, 07:43 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
|
|
Originally Posted by Eranga
Yep, normally called as unclosed character literal. 
So what is the different of,
System.out.println((String)"Java");
and,
System.out.println("Java");
I think there is no such an difference
Eranga ......What about last ans
__________________
sanjeev,संजीव
|
|

05-09-2008, 07:57 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
|
|
Originally Posted by sanjeevtarar
I think there is no such an difference
There is no difference. Just casting confused. I see lots of time newbies confused on this. actually println() do all those things for you.
Originally Posted by sanjeevtarar
Eranga ......What about last ans
What you mean Sanjeev. I answered to it on post #101.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best? Vote Now
|
|

05-09-2008, 08:01 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
|
|
Originally Posted by Eranga
What you mean Sanjeev. I answered to it on post #101.
OK DEAR.............
moreeeeeeeeeeee......
__________________
sanjeev,संजीव
|
|

05-09-2008, 09:59 AM
|
 |
Member
|
|
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
|
|
Oh Quiz Time
I AM BACK !!!
__________________
Life was much better in 2021
|
|

05-09-2008, 10:02 AM
|
 |
Member
|
|
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
|
|
who is going to take the honor to sum up all the puzzles and there answer along with incorrect one as well as cool moments  of this thread ...
__________________
Life was much better in 2021
|
|

05-09-2008, 11:09 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
|
|
|
I don't think it's much better. We do this just to catchup something. Some answers are not given honestly, try to pointed something. Isn't it?
So it's better to keep going like this.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best? Vote Now
|
|

05-09-2008, 03:08 PM
|
 |
Member
|
|
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
|
|
|
once againg STRING comaprison by ==
predict the output!! an as rule says, don't compile it just see and post the answer
package com.faaltu.Quiz;
public class StringInternTest {
public static void main(String[] args) {
String str1 = "string";
String str2 = new String("string");
String str3 = new String("string").intern();
if ( str1 == str2){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
if ( str1 == str3){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
if ( str2 == str3){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
}
}
__________________
Life was much better in 2021
|
|

05-09-2008, 03:14 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 218
|
|
|
Neah
Yeah
Yeah
__________________
Definition of Impossible = making a good game in Java.
|
|

05-09-2008, 03:15 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 218
|
|
|
How is mine two long it has everything you guys have talked about with objects , and then some so instead of posting 5 little ones I did one big one.
__________________
Definition of Impossible = making a good game in Java.
|
|

05-09-2008, 03:21 PM
|
 |
Member
|
|
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
|
|
NEAH NEAH NEAH
You are wrong,
try again,
How is mine two long it has everything you guys have talked about with objects , and then some so instead of posting 5 little ones I did one big one.
My friend as said already, keep only the catchy part! that puzzle looks lika an essay 
__________________
Life was much better in 2021
|
|

05-09-2008, 03:46 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
|
|
|
Is it correct?
NEAH
SAME
NEAH
__________________
sanjeev,संजीव
|
|

05-09-2008, 03:58 PM
|
 |
Member
|
|
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
|
|
|
correct
Thts Right Sanjeev,
What's the answer of this:-
package com.faaltu.Quiz;
one more
public class StringInternTest {
public static void main(String[] args) {
String str1 = "string";
String str2 = new String("string").intern();
String str3 = new String("string").intern();
if ( str1 == str2){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
if ( str1 == str3){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
if ( str2 == str3){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
}
}
__________________
Life was much better in 2021
|
|

05-09-2008, 04:00 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
|
|
Originally Posted by rjuyal
Thts Right Sanjeev,
What's the answer of this:-
package com.faaltu.Quiz;
one more
public class StringInternTest {
public static void main(String[] args) {
String str1 = "string";
String str2 = new String("string").intern();
String str3 = new String("string").intern();
if ( str1 == str2){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
if ( str1 == str3){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
if ( str2 == str3){
System.out.println("\nSAME");
}else{
System.out.println("\nNEAH");
}
}
}
SAME
SAME
SAME
because you are using intern()........which causes new String object to point existing one if any exist.
__________________
sanjeev,संजीव
|
|

05-09-2008, 04:50 PM
|
 |
Member
|
|
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
|
|
es el correcto!
next puzzle please
__________________
Life was much better in 2021
|
|

Today, 04:32 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
|
|
Hi, guys. I'm back here. 
I would like to make a request from all of you guys. Please don't use PHP tags when posting codes or quotes in forums. It's make the browser keep too wide on the scree. 
Thanks
Eranga
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best? Vote Now
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|