Question about final instance variables

Hi, I recently have come across a situation that I realized I did not understand and I could not find the answer after a bit of googling and searching the forum so I thought I would quickly pose the question to the crowd. Basically I want to know if declaring a final instance variable and assigning it to an existing Object will make an immutable copy of that Object. For example:
Dimension myDims;
public void someMethod()
myDims = new Dimension(320, 240);
doSomething();
public void doSomething()
final myFinalDims = myDims;
This is not real code (obviously) and I made it quickly just to get my point across. Basically my question is if I create an Anonymous Inner class within the doSomething() method that accesses the myFinalDims variable, will the inner class actually access the myDims variable (which could have its value changed before the inner class accesses the variable) or will it be accessing a copy of the myDims Object that will have the same value as when the final variable was declared and instantiated?

Basically I want to know if declaring
a final instance variable and assigning it to an
existing Object will make an immutable copy of that
Object. Big no. It will neither make a copy, nor will anything be immutable. Final just means that once the value or reference of the attribute or variable is set, it can't be altered.
final StringBuffer sb = new StringBuffer();
sb.append("!");still works.
Your inner class will access the instance of Dimensions stored in myDims. There won't be any other instance.

Similar Messages

  • Question about Hyperion Environmental Variables

    Hi,
    Can someone please give me a clear explanation about the following Environment variables in Hyperion. I am very much confused about these variables, it would be really helpful for me to understand better if I get a clear explanations of those.
    1) ARBORPATH
    2) ESSBASEPATH
    3) HYPERION_HOME
    4) ORACLE_HOME
    5)ORACLE_INSTANCE
    Thanks in advance!!!
    Regards,
    Newton

    Basically I want to know if declaring
    a final instance variable and assigning it to an
    existing Object will make an immutable copy of that
    Object. Big no. It will neither make a copy, nor will anything be immutable. Final just means that once the value or reference of the attribute or variable is set, it can't be altered.
    final StringBuffer sb = new StringBuffer();
    sb.append("!");still works.
    Your inner class will access the instance of Dimensions stored in myDims. There won't be any other instance.

  • Jdev11 complains about public instance variables, but not Jdev10

    Hi all, if I fire up Jdeveloper10 I can declare a public instance variable. (OK, stylistically maybe not a good thing, but nothing in the java 'rules' that says I shouldn't be able to do this.) However in Jdeveloper11 it complains, it underlines it in red and grumbles "should not have greater than protected access."
    Anyone know where to turn off this compiler hint?
    thanks.
    public class Thing() {
    public String bob; // complains in jdev11, ok in jdev10.

    Hi Kevin, thanks for the tip. It's taken me years just to remember where to turn on the line numbers in 'preferences' , so I would never have found that one about the instance variable checks ! Frank, thanks for the update, I agree it's useful as a stylistic hint, but I think that the Jdev floating code assist, rather than just hinting "declare this field protected" (as this will obviously fix it) would be more user-friendly if it also said "or disable under preferences - code assists." But Jdev11 is growing on me, tons of cool stuff :-)
    thanks all.

  • Question about using constant variables in Forms

    As I am still very new to Forms, please forgive my ignorance if the answer to my question is very simple. I am trying to figure out how to use constant variables within my Forms application. For example, if I want to setup return code constants for the application (mind me, these are examples):
    RC_SUCCESS CONSTANT PLS_INTEGER := 1;
    RC_FAILURE CONSTANT PLS_INTEGER := 0;
    RC_YEAR_DATA_NOT_FOUND := 50;
    Then in a module I created, if I wanted to check the return code against one of the constants I would do:
    DECLARE
    rc PLS_INTEGER;
    BEGIN
    GET_YEAR_DATA('2000', rc);
    IF rc = RC_YEAR_DATA_NOT_FOUND THEN
    -- Do some error handling
    END IF;
    END;
    I know that you can declare constants within individual procedures or packages but I can't see to find information on how to do this globally for the application. I've read about using global variables within Forms but the CHAR data type only and the fact the value can be changed doesn't really fit for this purpose. Am I missing something? Is there a config file or something for the webserver that can be used to set these up??
    Any help would be appreciated.
    Thanks

    To declare constants create a Package-Specification in a pll and deifne all your constants there, something like:
    PACKAGE PK_CONSTANTS IS
      RC_SUCCESS CONSTANT PLS_INTEGER := 1;
      RC_FAILURE CONSTANT PLS_INTEGER := 0;
      RC_YEAR_DATA_NOT_FOUND := 50;
    END;Then attach that pll to all your forms-modules, and use it like
    IF rc = PK_CONSTANTS.RC_YEAR_DATA_NOT_FOUND THEN
    END IF;A word about exceptions or errors: In my eyes its clearer (and in case of exceptions even better) to raise an exception than to hide it behind return-codes.

  • About "method", "instance variable" and "constructor"

    Does a method need to be initialise?? if yes, how to write the code?
    for example,is it:
    public String mymethod( String args[]); ?
    public double mymethod2 (); ?
    what is the meaning of "instance variable" and "constructor"?
    Please help.....THANKS!

    Previously posted to this OP:
    Read the Java Tutorial: Learning the Java Language.
    http://java.sun.com/docs/books/tutorial/java/index.html
    � {�                                                                                                                                                                                                                                                                                                   

  • Question about Final Cut Studio 3/Final Cut Pro 7

    Last year I bought Final Cut Studio 2 and got a student discount.
    I was thinking about upgrading to Final Cut Studio 3, but I saw a post that said you can't upgrade if you have the academic version. First of all, is this true, and secondly how can I tell if I have the academic version?
    If I can't upgrade, I can't afford to buy the whole package again. And surely I should have been informed of this! But can I edit a project on Final Cut Pro 6 and then work on it on Final Cut Studio 7, and back again? I presume not, but it's worth asking because I'm pretty much screwed if not and I can't get the upgrade.
    Thanks

    I want to upgrade because the macs at uni have upgraded, and I don't live near the uni I attend so it isn't practical for me to stay in their edit suites till late like everybody else does. I only bought the mac and final cut studio last year for this reason! So I prefer to edit from 2 machines: Mine, when I can, and the ones at uni when I'm collaborating with the 'crew'.
    However, I cannot see academic version written anywhere. And I know this is going to make me sound even more stupid than I already do, but I can't remember if I got the student discount on Final Cut, or whether it was just on the mac. Does anyone know where I should be looking. I've checked the 'about final cut pro' details and looked through the packaging (and my emails for the receipt) but I cannot see anything.
    Thanks

  • 2 Questions about final cut pro 5

    My first question is quite simple, I know that previously final cut pro could only use up to 2.5GBs of memory, now I'm just a bit curious if it can use more since leopard is a 64-bit OS. Right now I'm using Final Cut Studio 1. I'm just asking this question since I intend to get an additional 4GB of ram (Right now I only have 2GB) I'm going to get Muskin's MacPro memory. I generally run my system down to about 200MB of free memory and sometimes down to 10MB when I'm using photoshop in conjunction to FCP. What does everyone think about getting an additional 4GB?
    Thanks for the answers.
    Okay, to not make two posts I'm give me final question/Problem. Ever since I've upgraded to Leapord I noticed that the playback quality in the canvas and viewer is poor. There is bad gamma. What I mean by that is that i'm getting extremes in color, I have areas that look normal followed by areas of over saturated color. It's more on the over saturated side though. Besides that the play back quality is poor, even though my sequence settings are at "Best" for video processing. I also seem to get jagged lines on things like railings, people's shoulders, and on other edges. My picture quality is grainy, however there are no artifacts. Even on the FX transistions I get the jagged lines on edges of oh say page peels and what not.
    Now when using DVD player or watching my MPEG2's on DVD Studio, they play poorly too. The image is clear however I get the horizontal lines when there is motion. Now when I put one of my DVD's in my DVD player (not computer) the problem goes away and everything looks fine. This is less of a problem (the horizontal lines), but I don't understand the poor playback quality.
    The video looks fine on my external NTSC video monitor.
    I have the GeForce 7300 graphics card, with the 24" samsung 245BW. I upgraded to 10.5 on a clean install.
    Thanks a lot everyone!!

    Thanks for my memory question!
    However I'm still getting poor looking footage. Even when I open up my source clips and play them they look poor in quality. I'm getting the horizontal lines on everything that moves and corners are not sharp, they look distorted and jagged. I never had this problem before I'm not sure whats the cause or the solution. Even the footage from Final Cut Studio's tutorial looks bad (grainy, strange contrast, jagged corners and lots of horizontal lines). However the edges on my footage look a little more jagged. I think i mentioned it already but the FX transitions that are page peels, cube spins...etc give me jagged edges too.
    I removed flip4mac and all other non-apple codecs too.
    ugh i hate computers sometimes
    -Tom

  • Setting final Instance variables in Child Classes

    Hello:
    Is it possible to declare (not initialize) a final variable in an abstract parent class and set it in a non-abstract child class.
    An example for clarification.
    I have an abstract parent class (call it P) and two child classes (call them (C1 and C2). There is common processing that goes on in P. This processing uses a variable called x. C1 will set x to equal 10 and C2 will set x to equal 20. Can I declare x final in the abstract class P and set it in C1 and C2
    This is impossible right? I know some other languages allow this behavior so I just wanted to make sure that Java does not support it.
    Thanks
    Johnny

    Why don't you just try it out? Though I'm pretty sure it won't work, as it should expect all constructors of the abstract class to set it. But you could either let there be an overridden method that returns the appropriate value for the sub-class:
    abstract class P
      abstract protected int getTheValue();
    class C1 extends P
      protected int getTheValue() { return 10; }
    class C2 extends P
      protected int getTheValue() { return 20; }
    }

  • Basic questions about Objects and variables...

    If I have the following:
    Species theAnimal = new Species();
    Am I right in saying that the object here is 'theAnimal'?.
    If we just wrote it as:
    Species theAnimal
    Then i'm assuming that here 'theAnimal' is the variable name...right?
    I'm just trying to get facts straight when reading.
    Thanks for the help...
    Yash

    At first, theAnimal is pointing to one object, and
    theMammoth is pointing to another?
    In the final line, they're both pointing to the same
    object. Isn't that kind of saying, they're pointing
    to the same memory address/location?Yes.
    They might actually hold the physical memory address of the object, or they might hold some other abstraction that the VM uses to locate the object. In either case, though, they both hold the same value, and you can picture that value as the address of the object.

  • Questions about final cut studio 7 and motion 5

    Hello!
    I have two questions:
    1. How do I find all the updates to the final cut studio? Last came out before the final cut pro x came out.
    2. Works Motion 5 good up to final cut pro 7? Will there by any problem to use both prorammene against each other? And if so, what kind of problem can arise?
    I would be grateful if someone could tell me this because I had settings alert Motion 4 (which now crashes at startup). And considering buying Motion 5 for I will not have to be automatically installed again my whole system that works one hundred percent. The job I would rather not do.
    I'm not so good English so I hope you understand what I mean.
    Can any help me for this little crisis I have a lot of work left and wait. :-(

    This I have done to run instaleringen the entire final cut studio re-enter. Ran software product update. Have checked the final cut pro and then I have version 7 and version7.0.3 as I had before.
    Before this, I have thrown the preference files for Motion 4, but disk utility to repair permissions on the system drive, I have not used.
    But how can a fjærne entire final cut studio package also put it in again so we have aclean new installation of the programs?
    How can we explain that this has happened? Just what I do not understand.
    Are happy for all the tips I get. For I dread to put reindeer speakers the whole thing sinceit worked so well as it did before this happened.
    Thanks to all who will help me. I will be very happy if this can be solved in an easymanner without having to spend a whole day on automatically installed everythingagain.
    ke

  • Question about final format for integrated film clips and moving images in webpages created by Muse

    About a year ago I gave up even trying to construct websites. There were too many new factors and technical aspects of correct scripts and coding to make it interesting for a designer with no interest in programming. It´s understandable that all new gadgets such as mobile surf panels, mobile internet on different cell phones, lap tops and stationary computers and a lot of different browsers made it impossible to run with just plain html. But when I found out that many viewers couldn´t even watch Flash movies or solutions with flash components I said enough is enough.
    Now a while ago when HTML5 was released I heard that it made it possible to create films and almost identical content as with Flash films without using them. Bought some templates and realized that it really worked. So here are my questions:
    What format does Adobe Muse CC use when I add films and stuff into it, and what format will come out of it when it´s an official website?
    Do Adobe Muse CC convert film formats so they will be visualized correctly on the end viewers browser, computer or phone?
    Will Adobe Muse CC advice me of what film or animation format will be the best for my viewers on the web or on a mobile internet?
    Are there any guidelines available for how I shall save and export filmclips or animations before they are imported into Adobe Muse CC?
    Regards
    Jack

    Hello Jack,
    Currently, you can only import an swf file or you can embed videos from youtube, vimeo etc. into Muse / add HTML5 Video to Your Website.
    Take a look at these simple videos that explain the currently available processes for adding videos in Muse, in a step by step method:
    1. http://tv.adobe.com/watch/learn-adobe-muse-cc/inserting-a-youtube-flic kr-or-hulu-video/
    2. http://www.youtube.com/watch?v=5in4swnIFsw
    3. http://www.youtube.com/watch?v=KnBFLQheOk4
    Hope this helps.
    Cheers
    Parikshit

  • Question about Final Cut Pro X and miniDV's

    Hi,
    I'm thinking in buying Final Cut Pro X and use it to import and edit many hours of footage that I have on miniDV's tapes.
    I've heard that to work with miniDV's, Final Cut Pro X is not great, especially regarding timecode, etc. True?
    Any thoughts and advises? Many thanks!

    My experience is if you're shooting SD then you shouldn't have a problem unless you are trying to load a full hour. When I tried that, the computer went crazy and loaded the video as thousands of clips just a few frames long.
    That was supposed to be for a multicam shoot. I went back to FCP 7 where I've never had a single problem after at least 80 multicam projects with as many as eight cameras.
    I'll have to try it again in FCP X now that there have been two updates since my last try.
    I've also used HDV mini DV tapes shot with a Canon HV40. The video looked great in FCP X and I had no problem with clips that were 2-3 minutes long.
    I did not load my HDV clips as ProRes in FCP X because, when I did try it, they looked like total crap. I was afraid my finished exported video would also look like that.

  • Question about Visited slide variables

    Hi All,
    I have seen an effect in a scorm course that I would like to replicate, unfortunatly it was not in Captivate.
    I would like a button to contain a table of contents to appear when you hover over a button/image. Next to the title of the slide I would like a tick to show if the user has visited the slide or not.
    There are 20 slides in my module and to represent this I would like 20 small squares at the bottom of each slide. Is it possible for them each to be a button that a) takes user to corresponding slide, b) Is red if it is the slide they are looking at, and c) Is blue if they have visited it as now they can technically jump to any slide.
    Thanks in advance everybody.
    Chris

    Hi Chris
    Aside from using the Table Of Contents (TOC) feature, Captivate doesn't really offer anything like this.
    If you want to be adventurous, you could construct something like that using images and variables and Advanced Actions to hide and show the images.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • General Question About common Instance Names in Flash CS4 (AS3)

    I tried something interesting recently. I had code effecting an object with the instance name : object_mc.
    Now I added another object and gave it the same instance name.
    The result was, that the code only effected the most recent added object (no error).
    Is there a way in flash to have multiple objects with the same instance name all being affected by one piece of code?
    ~ Thanks for any thoughts, advice or facts. ~

    Advice: avoid it... if you want to control different instances, give them different instance names.
    It depends on what you mean by "one piece of code".  Directly using the instance name to target the movieclips will work as you have seen already... Last one added gets the attention.
    To use the instance name to take action is doable more along the lines of testing each movie to see if it has the name, but still, you would have to target each using a different means. 
    For the piece of code below I have some number of objects on the stage and I test to see if they have an instance name assigned (object_mc) that is shared by some of them, and I am able to move them if they do, but I cannot use the instance name to target each of them for action... in this case I use the getChildAt method.
    for(var i=0; i<this.numChildren; i++){
    if(this.getChildAt(i).name == "object_mc"){
      this.getChildAt(i).x += 200;
      object_mc.x += 25;  // only moves the last object added

  • Question about Final Cut Express 4

    I'm editing videos I shot with a Sony CX100 this model only shot in AVCHD.
    After I finish editing and export will not find a codex ideal for video that's perfect without being dashed
    Anyone have any solutions or tips?
    Or is it better if I buy Final Cut Pro once and for all.

    Convert the original AVCHD files into AIC at the same settings you recorded, then import the resulting AIC files into an FCE project.
    -DH

Maybe you are looking for

  • Frequent Panic Attacks for my Mac Book Pro Mountain Lion 10.8.5

    Hi All, My mac book pro with OSX mountain lion 10.8.5 has kernel panic attacks randomly couple of times a day. I have no idea why or when it gets trigerred. I dont have any third party drivers or extensions installed (except for  upgrading to 16gigs

  • Can't get printer to print [SOLVED]

    I'm trying to get my Brother MFC-7360N usb printer to work but so far all I can make it do is feed some paper. I'm using cups-usblp since I couldn't even get paper to feed with regular cups. There is a PPD for the printer but it doesn't respond at al

  • Display freezes randomly

    I've had my laptop for about 3 years. Lately the display has been freezing up at random times. Then when I go to turn the computer back on, sometimes it won't load properly. What's causing this?

  • Release date of IE 11 'Enterprise Mode' (EmIE)?

    I read announcements (e.g. http://www.zdnet.com/internet-explorer-11-to-get-new-enterprise-mode-7000025842/)  that IE 11 shall be equipped with a so-called 'Enterprise Mode' (EMIE) as a new feature. EMIE will allow businesses to specify which sites s

  • LFPMG Field in Tcode : VT02N in Item overview tab

    Hi All, How to get LFPMG field in VT02N tcode item overview tab, in which table it is storing? Thanks, Madhan. Moderator message: please do some research before asking. Edited by: Thomas Zloch on Mar 3, 2011 2:43 PM