Would U pls tell my why?

//Here is the first class
package com.xxx;
public class StringEquals {
     public static void main(String[] args) {
     System.out.println("hi there".equals("cheers !"));
     System.out.println(greeting.equals("cheers !"));
     private static final String greeting = "hi there";
     private static final Warper warper = new Warper();
//Here is another one
package com.xxx;
import java.lang.reflect.*;
public class Warper {
private static Field stringValue;
static {
// String has a private char [] called "value"
// if it does not, find the char [] and assign it to value
try {
stringValue = String.class.getDeclaredField("value");
} catch(NoSuchFieldException ex) {
// safety net in case we are running on a VM with a
// different name for the char array.
Field[] all = String.class.getDeclaredFields();
for (int i=0; stringValue == null && i<all.length; i++) {
if (all.getType().equals(char[].class)) {
stringValue = all[i];
if (stringValue != null) {
stringValue.setAccessible(true); // make field public
public Warper() {
try {
stringValue.set(
"Romeo, Romeo, wherefore art thou oh Romero?",
"Stop this romance nonsense, or I'll be sick".
toCharArray());
stringValue.set("hi there", "cheers !".toCharArray());
} catch(IllegalAccessException ex) {} // shhh
Why the outputs are true.
would you pls show me the details?

what is the difference between each other?Do you mean, the difference between literal strings and strings created dynamically?
The JVM has a special memory area called the "constant string pool." Literal strings go automatically to the string pool. You can put other strings in the pool by calling the intern() method on them. Interning returns a reference to a string in the string pool. The only difference is that string that is in the pool can be compared with a literal string using the ==-operator.
String hello = "hello"; // in pool
if (hello == "hello") { // this works
String world = new String("world"); // not in pool
if (world == "world") { // this doesn't work
world = world.intern(); // put it in the pool
if (world == "world") { // this works
}

Similar Messages

  • Can someone pls tell me why is it that i cant drag from the itunes movies to the playlist, but i can drag the songs to the playlist.  Thanks.

    Hi, can someone pls tell me why is it that I can't drag from the itunes movie library to the playlist, but able to drag songs to the playlist.  Thnaks.

    Are you able to receive any mail at all? If not, make sure that all of your information for mail is accurate in settings again. if you still have nothing, go to your email through safari. (example: www.yahoo.com) If you do not see the emails here either, it is a problem with the password reset server not your mail app.

  • Can someone pls tell me why?

    Hi,
    Im using a fixed pitch font which I thought meant that the distance between chars was always the same
    So using a fixed pitch font u can determine the max height and width of any char.
    The following code though shows this is not true. Am i using the wrong methods? I get the maxWidth being 8 yet X is width is 7!?!
    Thanks all
    private Font fixedPitch = new Font("Lucida Console", Font.PLAIN,  12);
      private FontMetrics fontMet;
        fontMet = getFontMetrics(fixedPitch);
        m_FontHeight = fontMet.getHeight();
        m_FontWidth  = fontMet.getMaxAdvance();
        System.out.println("Max Height: " +m_FontHeight);
        System.out.println("Max Width: " + m_FontWidth);
        int width = fontMet.charWidth('X');
        System.out.println("Test should equal max width! " + width);

    Okay, so don't just test with X. Do all letters have the same charWidth?
    Im using a fixed pitch font which I thought meant that the distance between chars was always the sameI would have thought it meant that every character used the same width when printed. This would mean that the distance between two letter I's would be more than the distance between two letter W's.

  • HT201328 i contact with at&t to unlock my i phone and they send me approved so would you tel me why not active yest

    i contact with at&t to unlock my i phone and they send me approved so would you tel me why not active yest
    <Edited by Host>

    We are all users like yourself so we would have no way of knowing any more details than you do.
    Did you follow the instructions AT&T provided when they informed you the device had been approved for unlocking?

  • Currently i am using a windows7 installed machine with following configurations intel core i5 2.60Ghz with Ram 8gb.(64 byte).I would like to install Mountain lion osx in my windows machine.Pls tell how to  install  mountain lion osx in my windows machine?

    Currently i am using a windows7 installed machine with following configurations intel core i5 2.60Ghz with Ram 8gb.(64 byte).I would like to install Mountain lion osx in my windows machine.Pls tell how to  install  mountain lion osx in my windows machine?

    Please stop asking about that on this forum.
    There are plenty of informations on the Internet if you want to do it but nobody here will help, because is against the forum's rules.
    And, you can't buy Mountain Lion if you do not have a Macintosh with at least Snow Leopard installed.
    There is no physical media. Mountain Lion is provided by Apple through the Mac App Store.

  • Can anyone tell me why a picture would change color when I try to download/upload it?  It is the exact same picture- chosen the same way and when it goes to any other program it changes the color (I've tried canvas on demand and mpixpro.  I've also tried

    Can anyone tell me why this picture changes color when I try to download/upload it?  It is the exact same picture I have taken from the same location.  The image on the left is via preview and the image on the right is what is shows like when I try to download it.  I have emailed it to myself and it shows fine on the computer and in CS4, but when I look at the download via my phone or on another computer it shows the wonky color on the right.  I have checked the color space shows RGB/8 bit.  Any ideas why or how to fix it?  It isn't with any one specific session.... and I've tried it on both my desktop and my laptop- saved image to an external hard drive and to drop box.  I've tried sending the image to canvas on demand, my email, mpxipro, POST editing- all the same result.  Please HELP!!  What am I doing wrong?

    Most of the time you see something like that. The image in question has a color profile other then sRGB. Some image viewers/displayers are color managed and others are not.  So the image do not look the same in all of the applications you use. So colors seem to change.
    Try converting it to sRGB color and see if then looks the same all around. Also I think PC and Mac displays are set to different gamma something like 1.8 and 2.2
    Though I'm colorblind I even see color variations.

  • Photo Stream is not syncing all of my photos on my Iphone 4.  I've checked all of my settings and they are all turned on, ready to go.  Can anyone tell me why it would randomly miss a few photos please?

    HELP!!  I have been to several tech support sites and have checked all of the settings for my Iphone 4, which appear to be on the correct "on" position HOWEVER when syncing with Icloud/Itunes via my Windows PC (windows 7) the Photo Stream comes up short 4 or 5 photos.  There are only 116 photos installed (plus 4 videos).  Would someone kindly tell me what's wrong and what I need to do to correct his?  PLEASE? This is driving me crazy & of course the photos that it aren't syncing are the important ones! THANK YOU!!!

    WOW! That font is difficult to read. But, see if this support document helps you http://support.apple.com/kb/TS3989. Photos stream is based on date and photos more than 30 days old are removed. Photostream is designed as a temporary storage to allow you to download the photos to the computer.

  • Am buying a phone for my gf and want it shipped to her and not me, pls tell me how to?

    Hey!I am buying a phone for my gf, she lives in US, and I in Canada.Pls tell me how to pay with my account but ship to her.Thank you

    You can add her address as a 'Gift Address' for exactly this reason.This protects the seller as well as you and your friend. It would be polite to let the seller know, if you do win, why your eBay address and your PP address do not match in this instance.

  • I've seen all the posts for fixing the wifi on the 4s, none of them work!  So, who can tell me why my iPhone 4S cannot find any wifi when it used to easily, and when it does it can never connect?

    I've seen all the posts for fixing the wifi on the 4s, none of them work!  So, who can tell me why my iPhone 4S cannot find any wifi when it used to find wifi, and when it does find a wifi network it can never connect?  You think apple would have a clue how to fix it!  Because turning the wifi on and off doesn't work, resorting network settings doesn't work, even restoring phone to factory default doesn't work...

    Did not work. I've selected iMessage to ON and left it. After a few hours I recieved a message "activation unsuccessful. Turn on iMessage to try again". This has been going on for the past 3 days.

  • Can you tell me why none of my music will play I had a little box that came up saying all your items are ticked so they will not play on itunes what does this mean it's driving me nuts help!!!

    HI there can you tell me why none of my music will play on itunes it just displays a message saying it cannot be located please help it is driving me nuts
    Jan

    About 5 days ago for no apparent reason at all, about
    7000 songs which i have collected over a number of
    years has just decided that it wont play in ITUNES or
    in any other of my media players. When you click on
    Play over a song nothing happens. The play icon
    doesnt even come up on the screen.
    Steps I have taken so far are:
    1 - Remove all tracks from ITUNES and then re-add the
    folder where all the songs are. This has obviously
    removed all songs, but when I have re-added the
    folder , it has added about 650 tracks back on to the
    playlist. These 650 tracks will play. This leaves
    approx 6400 tracks that it wont play.
    By the way all the songs on my PC are MP3 type and I
    have had no problem playing any of them until last
    week.
    2 - I have re-installed ITUNES and reinstalled
    Quicktime and that has not worked.
    3 - All of my songs are backed up on to a External
    Hard Drive. I have tried to restore the songs and
    also play them directly from the external hard drive.
    I get the same problem when I do this.
    4 - I have enabled and allowed all permissions for
    the account that I am running the PC from.
    I am guessing there must be some settnig or Registry
    Key that is blocking me playing the tracks from the
    PC. I have also tried to launch the songs in Media
    Player and Sonic stage but thsi has not played
    either.
    All the tracks are in the folder structure as they
    were before so I know they are there. I just need to
    somehow unlock them.......
    If anyone has any ideas, I would be very grateful as
    I dont want to lose my entire music collection.
    Also I cannot find anyweher on here that is a Support
    number or email address for Apple as this is an
    ITUNES issue and they should be resolving it for
    me!!!!
    Thanks
    Dell   Windows XP
    Pro  

  • Can anyone tell me why I am unable to download a template word doc from webmail onto my mac without it opening in text format? I just need the original document format.

    Can anyone tell me why I am unable to download a template word doc from webmail onto my mac without it opening in text format? I just need the original document format.

    Where to begin... and why would you ask here? (workstation owners)
    Places I can think to try, after google of course....
    Forum devoted to something like Word / Mactopia or Pages.... whether you are using Office 2011, and no idea what browser or webmail (IMAP, Gmail, other)
    And then there really are notebook with subforum for MacBook Pro
    Apple Site Map
    Apple Support Mail
    Apple Support

  • I bought my iPhone 5 almost an year ago and since the last 2 weeks my battery lasts about 2 hours or less, while before it lastre a whole day. Can anybody tell me why is this happening or how can i solve my problem, please? Thank you.

    I bought my iPhone 5 almost an year ago and since the last 2 weeks my battery lasts about 2 hours or less, while before it lastre a whole day. Can anybody tell me why is this happening or how can i solve my problem, please? Thank you.

    You can follow these steps to save battery.
    1. Turn on Auto-Brightness - The iPhone has an ambient light sensor that adjusts the brightness of the screen based on the light around it (darker in dark places, brighter when there's more ambient light) to both save battery and make it easier to see. Turn Auto-Brightness on and you’ll save battery because your screen will need to use less power in dark places.
    Find it in the Settings app -> Brightness & Wallpaper -> Auto-Brightness On
    2. Reduce Screen Brightness -the brighter the default setting for the screen, the more battery it requires. Keep the screen dimmer to conserve more of your battery.
    Find it in Settings -> Brightness & Wallpaper
    3. Stop Motion (iOS 7) -It's really cool, but it also drains battery. You may want to leave it on to enjoy the effect, but if not, turn it off this way: 
    Settings -> General -> Accessibility -> Reduce Motion -> move slider to green/on
    4. Turn Bluetooth Off-  Turn off Bluetooth except when you’re using it to squeeze more juice from your battery.
    Find it in Settings -> Bluetooth -> Move Slider to Off
    5. Turn Off Location Services -
    This allows your phone to know where you are and give you exact driving directions, give that information to apps that help you find restaurants, and more. But, like any service that sends data over a network, it needs battery power to work. If you’re not using Location Services, and don’t plan to right away, turn them off and save some power.
    Find it in Settings -> Privacy -> Location Services -> Slide to Off
    6. Don't Automatically Update Apps (iOS 7)-
    If you've got iOS 7, you can forget needing to update your apps by hand. There's now a feature that automatically updates them for you when new versions are released. Convenient, but also a drain on your battery. To only update apps when you want to, and thus manage your battery better:
    Settings -> iTunes & App Store -> Updates -> move slider to off/white
    7. Auto-Lock Sooner -
    You can set your iPhone to automatically go to sleep – a feature known as Auto-Lock - after a certain amount of time. The sooner it sleeps, the less power is used to run the screen or other services. Try setting Auto-Lock to 1 or 2 minutes.
    Find it in Settings -> General -> Auto-Lock -> Tap your Preference
    Few more things that would consume battery even when not is use are the applications that run in background.
    Follow the below steps to quit all running applications.
    1) Double tap on the home button on the iPhone ( this will display all apps that are running in the back ground).
    2) Just click on the tiny red X to quit application ( if iPhone is running on iOS 6 and below) else just swipe yhour finger over the running app upwards to quit ( if running on iOS7).

  • Most of the time I get The Connection Was Reset. Can someone tell me why this happens?

    When I click on Firefox or when browsing or going from one site to the other I get "The connection was reset" then have to click on Try Again.
    Can someone tell me why this is happening?
    Thank you.
    THE CONNECTION WAS RESET again this morning. I even get this message when I click on the Firefox Icon to get on the net. When for example I download something then it returns me to their site I get The Connection Was Reset. When I uninstall a program and it sends to to their site in order to answer as to why I am uninstalling their program then I get The Connection Was Reset.
    Every time this happens I have to click on Try Again and find this to be annoying.
    This does not happen once or twice a week, it happen ALL THE TIME.
    This morning I went to Safe Mode and followed the instructions on INTERRUPTED OR RESET CONNECTION which tells us what to do but this did not work either.
    Would be great if someone was able to let me know what to do in order to prevent this message appearing all the time.

    Do not know how to delete this reply. I replied instead of editing my question. I have edited the above now.

  • No new features for no Creative Cloud users? Tell me why?

    Adobe, please tell me why I, no Cloud Crative user don't receive new Illustrator CS6 features:
    - Package files
    - Unembed images
    - Links informations
    Why Creative Cloud users are better than users who bought box version? it's not fair.

    @Wade
    What a bunch of babble and marketing talk for Adobe! You do realize there are other services (far better ones actually) than YouSendIt, don't you? In the YouSendIt category, try WeTransfer.com : super fast uploads and downloads up to 2gb in one RAR or ZIP file at a time.
    You have heard about DropBox, SkyDrive, GoogleDrive, etc. too, haven't you? Without going into the pros and cons of any of those services, I can categorically say that each one is better... and cheaper... than an Adobe Cloud sub.
    And since you're talking about the world, and complaining at the same time about your upload speeds, that remains the same for the Adobe Cloud or any Internet service for that matter. Adobe Cloud is NOT faster than any of the above services I mentioned.
    Also you should know that there are many parts of the world, including HUGE chunks of the US, where broadband Internet still doesn't exist. There are some places that may never see broadband land lines, and those communities are installing LTE instead. LTE has it's advantages... but the main disadvantage is cost. No such thing as a "true Flat rate" with LTE, and you are bound to run up against "volume restrictions" and pay extra for exheeding them. No advantage then for Cloud users: they will pay on top.
    I personally use DropBox and SkyDrive syncing projects and files with assorted clients every day... including huge PSD and RAW file libraries. If I have a "one off" project, I use WeTransfer with no problems. If you have a client that refuses to learn the first thing about downloading files from a link, I'm sorry for you. I mean that without sarcasm. I would like to ask though: are they actually then playing with your native files in CS? Really? And they can't even download a linked ZIP? (See my comment below about suspects).
    You fail to convince me in the end, that Adobe's Cloud Drive is the best choice at the moment or in the future.
    Considering this thread is/was about Perpetual vs. Cloud subs, no one has mentioned the main underlying fact and potential reason for Adobe to push people to Subs: PIRACY.
    While very possibly not prevalent in North America... I would venture to say that in the rest of the world, 75% of CS installations are against the EULA, whether multiple machine installs and/or downright pirated. BTW: I have personally ran across the "multiple machine" install countless times at more shops/studios than I care to mention.
    I would like to add a "twisted logic" to my personally accepting the new Adobe Subs as the way to go, and especially for new features.
    IF (big if!) this is to cut down on piracy and the number of studios/shops driving media design/printing prices into the basement, because they don't actually "pay" for their right to offer their services....  I'm all for it! If this also results in the culling of people that think that, with a Walmart computer and a jacked CS disk image, they are "now in business to offer professional graphic services"... again, I applaud the Cloud initiative.
    It surely appears that I'm bitter about the "competition"... well yes I am. Because, not only are the pirates NOT competing fairly, but I (personally) have to deal with problems they make for my clients  and the "trash" files they receive on a daily basis. It is also many of those clients that are perpetually licensed CS and EULA abiding Adobe customers, that are slowly laying off trained professional graphic/media designers as well as print technicians... because they are "too expensive".
    And finally to add insult to injury: I also suspect we see a number of these "pirates" and "just beginning professionals" here in these forums. The number of posts I see coming from some people that shouldn't even have CS installed, is... well... disheartening.*
    * Funny, how as graphic designers, we were always wishing for faster, better, cheaper, easier. How little did we realize or fail to foresee, that when the dream came true... it would also be accessible to the "I can too" crowd. Is it nasty of me to say in return, "No. You can't. And I doubt you ever will. It's not the tools, it's the talent. You have none that I can see."
    PS. Sorry... sort of worn out and emotional after staying up until 3.00am to "re-design" a thoroughly "#$%^&*!!!" Corel PDF! Fugly has a brand new definition, and "pro-" is followed by "-stitution". I need to shower 3 times after this one!

  • Because of to much energy needed some of my usb port in the front hve been unactivated pls tell me how to reactivate these 2 usb port located in front

    because of to much energy needed some of my usb port in the front hve been unactivated pls tell me how to reactivate these 2 usb port located in front
    my mac pro is an early 2008 intel xeon hapertown
    thanks a lot
    patrick stanley thiollet

    Thought you could use this info about getting FireWire to work!   First, you should always Repair Permissions in Disk Utility before and after any update; I would do that now. If you installed your update with FireWire plugged in, your Mac may not recognize it anymore.
    Try resetting your FireWire ports by disconnecting all FW devices, shut down your Mac and unplug it from AC power (wall socket) for 15 minutes. plug it back in and try FW.
      If that didn't work, download the combo update from this site (yours may be corrupt), not Software Update, disconnect all firewire + USB devices except keyboard + mouse, Repair Permissions, re-install update, Repair Permissions again + try.
    If that still didn't get it Zap the PRAM. While restarting Mac hold down the following key combo Command-Option-P-R. Keep holding those keys down till you hear the second start-up chime, then release. 
    A bad internal PRAM battery can also cause FireWire to not be recognized, so make sure it's good!   Also, here is Apple doc.#88338 on getting FireWire to work.
    Here's another Fw Faq.

Maybe you are looking for

  • Photos App - Sharing to Flickr

    I'm trying to share some photos to Flickr using this new Photos app (I used to use iPhoto) and I have the following problems: If I select too many then the Flickr option doesn't appear. If I reduce the number I can then see the Flickr option but shar

  • Unable to Export Movie (Error code = -32766)

    I get this error message when I try to export as .flv a short (10 sec) movie created in iMovie using three photographs (for use as flash slideshow on a website). Here's what I'm doing: Share>Export Using Quicktim>Export Movie to Flash Video>Save>Erro

  • Drill Down thru hyperlink and return

    Hi, In one of my report(REPORT A) I am drilling down using navigate to another report (REPORT B), and I have a "return" at the bottom of the report. I am facing the following problem when i do this: Step1: I am opening REPORT A and drilling down usin

  • Positioning image?

    I have two images in their own div tag but I'm not having any luck keeping them level with each other. The 2nd image want to jumps to the division below. I floated the 2nd image right and cleared left but this doesn't isn't keeping my image level wit

  • Upgrade CS5 Extended to CS6 Standard Mac

    Hi ! I own Adobe Photoshop CS5 Extended for Mac. I don't want to join Adobe Photoshop subscription CC, but want to upgrade to Photoshop CS6. I'd like the standard version of CS6 - not the Extended upgrade as it's much cheaper. Is it possible to buy /