Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





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.

Reply
 
LinkBack Thread Tools Display Modes
  #101 (permalink)  
Old 05-09-2008, 07:38 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Yep, normally called as unclosed character literal.

So what is the different of,

Code:
System.out.println((String)"Java");
and,

Code:
System.out.println("Java");
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Want to make your IDE the best?Vote Now
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #102 (permalink)  
Old 05-09-2008, 07:43 AM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
sanjeevtarar is on a distinguished road
Quote:
Originally Posted by Eranga View Post
Yep, normally called as unclosed character literal.

So what is the different of,

Code:
System.out.println((String)"Java");
and,

Code:
System.out.println("Java");
I think there is no such an difference

Eranga ......What about last ans
__________________
sanjeev,संजीव
Bookmark Post in Technorati
Reply With Quote
  #103 (permalink)  
Old 05-09-2008, 07:57 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by sanjeevtarar View Post
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.


Quote:
Originally Posted by sanjeevtarar View Post
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
Bookmark Post in Technorati
Reply With Quote
  #104 (permalink)  
Old 05-09-2008, 08:01 AM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
sanjeevtarar is on a distinguished road
Quote:
Originally Posted by Eranga View Post

What you mean Sanjeev. I answered to it on post #101.
OK DEAR.............

moreeeeeeeeeeee......

__________________
sanjeev,संजीव
Bookmark Post in Technorati
Reply With Quote
  #105 (permalink)  
Old 05-09-2008, 09:59 AM
rjuyal's Avatar
Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
rjuyal is on a distinguished road
Oh Quiz Time

I AM BACK !!!
__________________
Life was much better in 2021
Bookmark Post in Technorati
Reply With Quote
  #106 (permalink)  
Old 05-09-2008, 10:02 AM
rjuyal's Avatar
Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
rjuyal is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #107 (permalink)  
Old 05-09-2008, 11:09 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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
Bookmark Post in Technorati
Reply With Quote
  #108 (permalink)  
Old 05-09-2008, 03:08 PM
rjuyal's Avatar
Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
rjuyal is on a distinguished road
once againg STRING comaprison by ==
predict the output!! an as rule says, don't compile it just see and post the answer

Code:
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
Bookmark Post in Technorati
Reply With Quote
  #109 (permalink)  
Old 05-09-2008, 03:14 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 218
Zosden is on a distinguished road
Neah

Yeah

Yeah
__________________
Definition of Impossible = making a good game in Java.
Bookmark Post in Technorati
Reply With Quote
  #110 (permalink)  
Old 05-09-2008, 03:15 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 218
Zosden is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #111 (permalink)  
Old 05-09-2008, 03:21 PM
rjuyal's Avatar
Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
rjuyal is on a distinguished road
NEAH NEAH NEAH

You are wrong,

try again,
PHP Code:
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
Bookmark Post in Technorati
Reply With Quote
  #112 (permalink)  
Old 05-09-2008, 03:46 PM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
sanjeevtarar is on a distinguished road


Is it correct?

NEAH

SAME

NEAH

__________________
sanjeev,संजीव
Bookmark Post in Technorati
Reply With Quote
  #113 (permalink)  
Old 05-09-2008, 03:58 PM
rjuyal's Avatar
Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
rjuyal is on a distinguished road
correct
Thts Right Sanjeev,

What's the answer of this:-

package com.faaltu.Quiz;

one more

Code:
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
Bookmark Post in Technorati
Reply With Quote
  #114 (permalink)  
Old 05-09-2008, 04:00 PM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Mumbai(India)
Posts: 230
sanjeevtarar is on a distinguished road
Quote:
Originally Posted by rjuyal View Post
Thts Right Sanjeev,

What's the answer of this:-

package com.faaltu.Quiz;

one more

Code:
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,संजीव
Bookmark Post in Technorati
Reply With Quote
  #115 (permalink)  
Old 05-09-2008, 04:50 PM
rjuyal's Avatar
Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 92
rjuyal is on a distinguished road
es el correcto!


next puzzle please
__________________
Life was much better in 2021
Bookmark Post in Technorati
Reply With Quote
  #116 (permalink)  
Old Today, 04:32 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 1,136
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Startup time JavaForums Java Blogs 0 02-04-2008 12:40 PM
Hello, first time here. ludragon Introductions 2 01-03-2008 06:03 AM
Help pls with a quiz saytri New To Java 3 12-23-2007 07:09 AM
Time method carderne New To Java 5 11-05-2007 10:34 AM
DataObject with the time given by me garinapavan New To Java 2 08-07-2007 07:33 PM


All times are GMT +3. The time now is 01:53 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org