Java has a bug

Hi
All variable pass into a function, shuould passed by value, so we are not able to change the original variable through the parameter. But something wrong here:
import javax.swing.tree.DefaultMutableTreeNode;
public class tt{
public static void main(String[] args){
     DefaultMutableTreeNode t=new DefaultMutableTreeNode("123");
ccc(t);
     System.out.println(t.getUserObject());
static private void ccc(DefaultMutableTreeNode a){
     a.setUserObject("456");
it should print 123, but it print 456. Should it be a bug of Java?
thanks from Peter ([email protected])

u have not understood the concept of object references thats y u feel its wrong..be careful when u make such statements.
When objects are passed to functions, its the object reference thats getting passed, and obviously the reference is passed by value.but using this reference, the function can point to the actual object in the heap and if any change is made..it reflects the actual object.
here..object reference is passed by value which gets allocated in the functions stack and it points to the actual object which is allocated in the heap.
hope its clear..its not a bug..
sandeep joseph

Similar Messages

  • ListTransferHandler in DropDemo has a bug

    Hi -
    I would like to enable Drag and Drop in a JList containing Strings. To do that, I used the ListTransferHandler.java that is used in the DropDemo. Unfortunately, this ListTransferHandler.java has a bug. You can try that yourself by enabling the 'insert' drop mode and dragging, say, 'List Item 3' to the top of the list in the DropDemo: http://download.oracle.com/javase/tutorialJWS/uiswing/dnd/ex6/DropDemo.jnlp
    I tried to find the bug, but was not successful. To me it is interesting to see that the importString() method is not called, and, therefore, the addCount variable never get's updated.
    So am I missing the point of enabling DnD in a JList? Don't I need to implement a ListTransferHandler myself? At least it did not help to use a 'blank' TransferHandler jScriptList.setTransferHandler(new TransferHandler("text"));
    Has anybody a working ListTransferHandler for me please?
    Thanks and best regards,
    Kurt

    When I try to drag and drop and item, such as "List Item 3" over "List Item 1", "List Item 1" is removed from the list and "List Item 3" is put in its place. If I drag and drop some text from the textbox, the item in the list area disappears.
    During the drag and drop process, the 'drop' action results in the following exception:
    Exception in thread "AWT-EventQueue-0" java.security.AccessControlException: access denied (java.awt.AWTPermission accessClipboard)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkSystemClipboardAccess(Unknown Source)
         at sun.awt.dnd.SunDropTargetContextPeer.getTransferData(Unknown Source)
         at sun.awt.datatransfer.TransferableProxy.getTransferData(Unknown Source)
         at java.awt.dnd.DropTargetContext$TransferableProxy.getTransferData(Unknown Source)
         at dnd.ListTransferHandler.importData(ListTransferHandler.java:46)
         at javax.swing.TransferHandler$DropHandler.drop(Unknown Source)
         at java.awt.dnd.DropTarget.drop(Unknown Source)
         at javax.swing.TransferHandler$SwingDropTarget.drop(Unknown Source)
         at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source)
         at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(Unknown Source)
         at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Unknown Source)
         at sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processDropTargetEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

  • Version 3.6.14 has a bug & does not support Java to play Pogo games - How do I install a earlier version?

    Pogo games plays on Java - the last version of Firefox 3.16.14 has a bug that does not support Java - I have been instructed by Pogo to install an earlier version of Firefox. How do I do that?

    Firefox 3.6.15 was just released to fix that Bug.
    You can use Help > '''Check for Updates''' to trigger an update to Firefox 3.6.15.

  • HT201412 After ios7, My iphone4 has gone dead twice in a time frame of around two months...even though its not happening very often but a two month Old phone going dead just after a New update is not acceptable.probably ios7 still has sum bugs dat need to

    After ios7, My iphone4 has gone dead twice in a time frame of around two months...even though its not happening very often but a two month Old phone going dead just after a New update is not acceptable.probably ios7 still has sum bugs dat need to be fixed...Can this bug expected to be fixed in the next update...

    Hi 1283ar.
    Unfortunately, iOS 7 is too hard to push for the iPhone 4 and therefore has a lot of effects turned off to try to get it to run as smoothly as possible.
    However, it becomes better and better with each update coming but it's hard to do anything about the hardware on an already released phones.
    If you still have trouble or think they are too hard. My tip is, if so, to restore your iPhone 4 and make a clean setup with no iCloud backup. But all your photos in a photostream so you can access it later.

  • Java has been disabled, how can I get it back?

    Java has been disabled, how can I get it back? It seems that Apple has decided that Java has two many security problems and has disabled it. I need Java to run GeoGebra. What can I do? I tried downloading the latest update from Oracle JRE-7u13.

    Not sure what you mean.
    You cannot open itunes?

  • Can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market

    can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market

    Java is no longer included in Mac OS X by default. If you want Java, you will have to install it.
    However, note that you should think twice before installing Java for such a trivial need as looking at stock market quotes. There are other ways to get that information that don't involve Java, and using Java in your web browser is a HUGE security risk right now. Java has been vulnerable to attack almost constantly for the last year, and has become a very popular, frequently used method for getting malware installed via "drive-by downloads." You really, truly don't want to be using it. See:
    Java is vulnerable… Again?!
    http://java-0day.com

  • HT5945 Java has updated again today, i use a jave plug in to run my virtual software to access my work from home, today i have an error message saying security will not allow access to my website that i use to log in to work from, this is a JREdetection e

    Java has updated again today,
    i use a java plug in to run my virtual software to access my work from home,
    today i have an error message saying that security will not allow access to my website
    i use to log in to work from, this is a JREdetection error,
    my system runs off java and citrix, i tried chrome,firefox and safari - same issue, if my system cannot detect java it wont run, it runs on plug ins.
    How to i change my sec settings to allow access to this website, as i can only see that i can add apps not web addresses?

    If you get an error that says can't backup, try moving the existing backup file to a safe location and thry again. again. You can find the location of the backup file here:
    iPhone and iPod touch: About backups

  • Why does auto brightness has a bug in iOS 7.1.1 . The brightness switches automatically to higher in bright places but not returns to lower brightness in dark places but when you lock and unlock it becomes normal

    Why does auto brightness has a bug in iOS 7.1.1 . The brightness switches automatically to higher in bright places but not returns to lower brightness in dark places but when you lock and unlock it becomes normal

    Hello,
    Same problem for me. Really a pain in the *** this bug ! Does Apple fixed it. I'm really suprised noone reports this problem  and apple does not adress this.
    Because of that, I cannot give it anymore to children because it hurts the view. Really a shame on the part of apple !
    Regards

  • My Iphone 6 Screen has been bugging Please Help

    My Iphone 6 Screen has been bugging out lately it bounces up and down and just gets really blurry. Does anyone know how to fix this?

    Hi,
    By "Bounces up and Down", do you mean this:
    The content of the screen drops down and about a third of the top of the screen is blank.
    When you press the home button or any icon, the content moves back to the top of the screen.
    If this is what you are seeing, it is intentional. It is meant as a way for you to be able to easily reach the icons at the top row of the screen.
    Double tap the home button. Do not press the button, just lightly tap it.
    All the content should drop down.
    Pressing the home button or any icon will shift the content back up again.
    This is a new feature designed for the larger screens in the 6 and 6+.

  • It has a bug in the calendar of IOS 7.0.3

    It has a bug in the calendar of IOS 7.0.3!!!! For exampplo, today is TUESDAY, the 29th and the calendar shows WEDNESDAY!
    Can anyone help me how to solve this problem?
    Thanks in advance,
    Fabiola Cargnino

    See this discussion. https://discussions.apple.com/thread/5498033?tstart=0 it seems to be only happening in one geographic area.

  • What does the statement: "Java has a standard!" mean?

    I'am writing a academic work. For that I need to compare Java and PHP. I found the statement "Java has a standard!" as advantage on a webpage, but what does it exactly mean???
    Edited by: drumn on Aug 6, 2008 5:45 AM

    drumn wrote:
    I'am writing a academic work. For that I need to compare Java and PHP. I found the statement "Java has a standard!" as advantage on a webpage, but what does it exactly mean???Ask the author.
    I'm not being facetious or trying to brush off your question. If you want to know what someone meant when they said something, ask them. It's the most direct line and gives the highest probability of getting a useful, accurate answer to your question.
    ~

  • Reader 9 has a bug, Reader X is a step backward.

    I upgraded to X because the latest reader 9 wasn't highlighting search / find terms consistently. Now with X, not only does it superficially look like a older version of reader, the toolbar customization is difficult, limited, and the search / find box is gone unless you hit the find button (or ctrl + F or apple + F). I use this feature all the time in writing scientific publications where I have to find a key word quickly when I'm reviewing articles and its very handy to just have the search bar on the toolbar. It just seems like this version has less features and versatility than the last. But the last has a bug, so I'm left with two less-than-optimal PDF viewers instead. Sure the some of the new features are going to be nice with X, but overall I think they took a step backwards with this new version, and should have fixed the bug from 9.4.5 first.

    I believe it was fixed with the 9.4/8.2.5 updates. See page 5 of the following: http://kb2.adobe.com/cps/837/cpsid_83708/attachments/Acrobat_Reader_ReleaseNote_9.4_8.2.5. pdf

  • General: Java has become so vast ... is there a way to join it all.

    This is a generic question and nothing to do with coding, but all to do with Java.
    Personally I am starting to find Java a little bit to vast. For example you have J2SE, J2EE, JDO, then you have Hibernate, Struts, Spring, SWT, and some others which I still don't know of.
    Now (Since I have have much time to waist) I started thinking the difference between the Java Development Environments and Visual Studio.Net (Just to make it a point, I prefer Java, mine is just comparision please).
    When installing VS.net you have all the technologies (.net framework) there at one go. With Java is a little bit different. You install the JDE which may come whit it's own jdk, and then you can continue adding on (Jars) for what else you want to add in your project.
    Now I know that this situation comes from the fact that Java has many different open source projects, while .net does not. However would it be great if there was an IDE that comes with everything (as much as I know eclipse does not, if yes please tell me).
    If this is not possible, is there a place which tells you all the technologies available out there in one list, whith just one click download?
    Again I am not critising Java in any way, I am saying is there a way to make it simpler to program with? I understand the answer can be a blunt no, but why no, or why yes?
    Thanks :)

    and I am sure that projects
    like Eclipse will reach VS.net.
    My view is that it already has.To make my Eclipse copy similar to VS.net (not like it) I had to install a plugin called Lomboz! Reaching is one thing .. overpassing is another, and that is what java needs (from an IDE perspective) to bring fresh programmers to it, programmers that are not coding in Java coz school demands it, but because they prefer it over other languages.
    To simplify the complex you have to streamline. Each
    "simplification" basically lowers the skills needed
    to perform a task. At the lower end just about
    "anybody" can program. This means that also "anybody"
    will program.I totaly agree with you, making things simpler will mean that any one will learn how to program with that language. VB6.0 was just an example of that. However VB6.0 became also the most popular tool when developing fast rapid applications just because of it's simplicity, which mostly came from the IDE.
    So Java programming will be simpler, don't worry. The
    question is will you be satisfied with the salary?hmmm ... I never am to say the truth :) I agree also with this point guess if things get simpler then salaries will go down ... too many people knowing the same thing will mean a lot for companies to choose from.
    However (I can be totally wrong here) doesn't Java (as a language) run the risk of no longer being used by "Most" of the industry just because there are few developers knowing it inside out??
    To download it you do need a bit of time. The J2ME PP
    reference implementation is over 30MB. The CLDC /
    MIDP stuff is over 25MB. That's a lot of download,
    but it's probably used by no more than 5% of Java
    programmers. I suspect Visual Studio .NET is
    primarily distributed on CD - I know the beta I have
    kicking around somewhere was.Well, my last version of VS.net came on 7 CD's and it took GB's out of my hard disk space. Having said that, I believe that in todays time Space and download time are no longer a big issue. But there are people having Dial-Up down there!! so one way I would solve this out would be to make a more interactive download page in which it lets you determine what packages to have in your installation.

  • New version 18.3.1.C.1.16 Xperia M2 D2303 has a bug again accelerometer (auto-rotate)

    The new version 18.3.1.C.1.16 (Customized CE1_1281-1548_18.3.1.C.1.16_R1B) Xperia M2 D2303 has a bug again accelerometer (auto-rotate). In the previous it was already repaired 18.3.1.C.1.15. During a phone call again suspended accelerometer (auto rotation).

    Are you talking about this thread?
    https://talk.sonymobile.com/t5/Xperia-M2-M2-dual-M2-Aqua/accelerometer-bug/m-p/984742#M5800

  • IOS7 has some bugs, Swipe changing lock screen! iphonehassomebugs

    Hi everyone,
    Iphone has some bugs(Part 1)
    Check this video for my very first bug experience,
    http://www.youtube.com/watch?v=QK_nIq4b82s&feature=youtu.be
    Steps to reproduce the issue:
    1. Keep the lock screen wallpaper and the home screen wallpaper different,
    2. Swipe right to unlock and swipe to the left immediately after you reach the right-end. Watch video for more reference.
    Other bugs on the way! .
    Regards,
    Sathish.

    Hmm, I have different wallpapers (one of my photo's for my lock screen and and just plain black for my home screen) and mine still does not do that.
    Try setting them both to something different, but simple - say different colors of one of the default screens.  Or just try one any pair of the default screens instead of your own custom pictures.  Does it still do it?  I cannot seem to get my iPhone to duplicate that no matter what I try with it.
    You can submit the info to Apple at http://www.apple.com/feedback/iphone.html  but try and give them as much details as you can, of anything you have tried that either does not change the abnormal behaviour or that does fix it.

Maybe you are looking for

  • When I download .pdf files from my office they are converted to .ashx files

    When I download a .pdf file from my Outlook mail box at my office, Firefox reads it as an .ashx file. However if I use Safari, it is read correctly as a .pdf file. How can I fix my Firefox browser? An IT person at my office said I should reset the do

  • Toshiba 3.0 USB external hard drive can't be accessed

    I got a new pc (8.1 64) The external hard drive shows up in the folders window, but when I try to open it, I get the following message:" F:\ is not accessible. Access is denied." My son-in-law says this is because when I originally set it up on my ol

  • Can i change page sizes in pages on ipad2

    I'm using the pages app on an ipad 2 which has limited templates. Can I change the size of a document before I print it as all seem to be A4?

  • High Noise on Analog Output PCI 6289

    Hi guys I am using  a PCI 6289 M series device for A/D characterization , I am using the device both for the analog output generation and also for data acquistion of the digital lines , The dynamic tests for the A/D were showing a very poor SNR ratio

  • Should I use a table for this ? Also, rounded corner photos

    Hello! I have the beginnings of a site up. One page has session prices and schdule info. I was unable to get these divs to look good using a table, so I just plunked in images. The client would eventually like to update this info herself, so obviousl