Reason for not allowing static declarations inside an inner class

Is the reason for not allowing static declarations inside an inner class is due to the fact that it can never be accessed at a class level as the outer class has to create an instance of the inner class and any attributes/methods of the inner class has to be accessed through that.
Typically, an instance (non-static) variable can never be accessed in a statement or expression inside a static context but the class variable can be accessed inside a non-static context. Given this, shouldnt the static declarations be allowed inside an inner class?
Correct me if my understanding is wrong.
Thanks

I still couldnt get it clearly. Why i cant i have a static value ( variable ) for all the instances of the inner class irrespective of its enclosing instances of it ( i.e outer class instances). Say in this example below,
class Outer
static int i = 0;
public Inner inner = new Inner();
class Inner // inner class ( non-static nested class )
int j = 0;
static final int k = 2; // compile time constants are allowed
// ininner class
public void m1()
j++;
System.out.println("j is " + j);
i++
System.out.println("i is " + i);
public static void main(String[] arg)
Outer outer1 = new Outer();
outer1.inner.m1(); // j will be 1 & i will be 1
Outer outer2 = new Outer();
outer2.inner.m1() // j will be 1 again & i will be 2. But I would
// want j to be 2. Why is this not allowed?
Looks like something missing..

Similar Messages

  • How to allow some fixed extension go in from outside to inside but not allow go from inside to outside

    how to allow some fixed extension go in from outside to inside but not allow go from inside to outside
    for example, allow JPEG, MOV, AVI data flow from outside to inside
    but not allow JPEG, MOV, AVI files access or upload or get by outside, in another words not from inside to outside
    how to configure?

    Hi,
    The ZBF link sent earlier show how we can inspect URI in http request
    parameter-map type regex uri_regex_cm
       pattern “.*cmd.exe”
    class-map type inspect http uri_check_cm
       match request uri regex uri_regex_cm
    ZBf is the feature on Cisco routers and ASA though concepts are little same but works differently. However it is important that you can be more granular with the protocol (layer 7) inspection only. Like on ASA if you will try to restrict .exe file from a p2p application that won't be possible, But on router you have some application for p2p in NBAR and you can use it file filtering. Please check configuartion example for both devices.
    Thanks

  • CAD "Select reason for not ready" not appearing for some agents? Please help!

    Hi all,
    I have some users who when they click on 'Not Ready' in CAD (Cisco Agent Desktop) - they are not presented with the 'Select Reason for Not Ready' dialog box - it just goes straight to Not Ready.
    I have searched high and low but have not found any suitable results (maybe I'm doing it all wrong?).
    Anyway - we use CUCM
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin-top:0cm;
    mso-para-margin-right:0cm;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0cm;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;
    mso-fareast-language:EN-US;}
    8.0.2.40000-1 and UCCX
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin-top:0cm;
    mso-para-margin-right:0cm;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0cm;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;
    mso-fareast-language:EN-US;}
    8.0.2.10000-41.
    Version 8.0(2) of CAD.
    Works for some agents and not others. All the same Windows operating system.
    Is there an individual setting which needs to be set on each user in CUCM or UCCX in order for this to be triggered?
    I would've thought it was universal?
    Cheers,
    Brett

    Ahhhh, spot on.
    Can't believe I missed it...
    Cisco Desktop Administrator (go) > Personnel > Agents > Set appropriate 'Work Flow Group'
    Agent logs out of and closes CAD, opens and logs back into CAD, tested, solved.
    Many thanks again

  • BAPI Program -Invoice_update- For not allowing MIRO if Quality not clear

    Hello Gurus,
    Does anybody have program done for BAPI -Invoice Update
    This is for not allowing user to post MIRO-Vendor Incoming Invoice Creation & Posting if any material against that PO or GR is lying in the Quality Inspection.
    Please send if you have the same.
    Thanks
    Rahul

    hi,
       You can use user exit  --EXIT_SAPLMRMP_010 (LMR1M001)    which definitely will solve ur issue.
       revert to me if u have any doubts on it.
    murali.c

  • OWS-00102 Reason for not creating a custom Java type: simple or mixed conte

    Hi ,
    I am generating the java proxies from a WSDL file in Jdeveloper and I am getting the below warning.
    WARNING: OWS-00102 Mapped {http://xmlns.fmr.com/systems/dev/aar/requests}ViewRequestStatusResult to javax.xml.soap.SOAPElement ViewRequestStatusResult. Reason for not creating a custom Java type: simple or mixed content is not supported.
    I have tried using Jpub as well, but it does not work as well.
    I am very new to JAVA and It seems some java code needs to be created. can any one please help me how to resolve this issue.
    Thanks and Regards,
    Vineet

    var cResponse = app.response({
    cQuestion: "Enter the section number to appear in the stamp.",
    cTitle: "Section Number",
    cLabel: "Section Number:"
    if (cResponse == null) {
    event.value = '*INVALID*";
    else
    event.value = cResponse;
    You can only remove the 'Warning JavaScirpt" is by creating a special application folder script for the 'app.response' method that uses the 'trustedFuncton' to suppress this security warning. Then in you form, you will need to test for this function and either issue a warning about the missing function or run the 'app.response' code and live with the warning. Each system will need the special application folder script installed on it.

  • Reasons  for  not  up dating the  planned revenue in internal order

    Dear   CO experts
    What  are the probable reasons  for not up dating the  the  planned revenue in  internal order . Eg  :  The order   value in CRM order  is not  flowing  to the  planned  revenue  in   internal order . The  GL  has  been  defined  for the  same in ECC and  CRM .
    What are  the points to be  checked if  the  planned  revenue  does not update  the  internal order.
    Where can i  find the documentation for  the  settings  of  CRM    to  ECC controlling.
    Regards   
    Raj

    Hi,
    Check in KOT2_OPA corresponding to your order type whether 'Revenue posting' is flagged.
    With regards,
    Mrinal

  • Frustrated with HP lame reason for not repairing a keyboard issue

    I recently called HP about a keyboard issue, where a the backspace key popped up and became detactched from the keyboard because the small latch broke under normal use. HP asked me to send the notebook back to them for replacement of the entire keyboard. When it got there, the case manager called back to tell me that they would not fix the keyboard because there was evidence of something being spilled on it. Although I don't recall any major spill on the keyboard I didn't deny that coffee drops may have reached the keyboard, nontheless that is not their concern and does not relate in anyway to the problem I resported to them. Yet HP refused to replace the keyboard and sent back as is. I must mention that the machine is functional and the spill has no effect on the operation of the machine. My frustration is with the broken key which affected my use of the keyboard.
    In spite of my appeal to the case manager and customer support, they insisted that it's against their policy to fix the keyboard because of the spill evidence on the keyboard.
    I am wondering if anyone else had a similar experience with HP service and particulary how they handled my service call. I am not accepting HP's lame reason for not fixing my keyboard and I was not happy I could nothing about it. I however use several HP products in my SOHO environment and this support incident left me with a bad experience.

    Hello andanderson,
    Sorry to hear about the troubles you have had with your laptop and with support. I am going to forward this to the appropriate team for review. Someone should be in contact with you shortly.
    Since this is a forum and we have no contact information for you, just your user id initial communication will be made through the forums private message feature. Please be on the lookout for a private message in regards to this issue.
    If I have helped you in any way click the Kudos button to say Thanks.
    The community works together, click Accept as Solution on the post that solves your issue for other members of the community to benefit from the solution.
    - Friendship is magical.

  • ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:la

    I have all these errors, can anyone help with this all means? trying to get my book published in iBooks. Nedd your help. Thanks, Jo
    ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"" at Book (MZItmspBookPackage)
    Use of the block quote element can cause ePubecheck to give the error "text not allowed here".  Text must not be alone inside of a body tag and if it is not enclosed in some other block level tag, this may lead to the error you are receiving.  

    I have all these errors, can anyone help with this all means? trying to get my book published in iBooks. Nedd your help. Thanks, Jo
    ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"" at Book (MZItmspBookPackage)
    Use of the block quote element can cause ePubecheck to give the error "text not allowed here".  Text must not be alone inside of a body tag and if it is not enclosed in some other block level tag, this may lead to the error you are receiving.  

  • HTTP server code 405 reason Method Not Allowed exception

    I get a 405 method not allowed exception in synchronous http receiver. However I have verified that a http post is expected by the receiver system.
    Is there anythin else I could check or what could cause the error?

    Hi,
    what is the receiving system? Usually, you get this error when you try to do POST on static page. In the HTTP header of response you should get the list of allowed methods. You can try to check this list. I would contact an administrator of that system if he can check logs for errors.
    Cheers

  • Status Profile for not allowing UD before RR

    Hi Experts
    I have customized a User Status Profile not to allow UD if no RR is done.
    But how ever in the case where I go to UD and try to do a UD for the lot which has not been RR it will give me status check error. So I cancel the error window and goes out of UD transaction. But while going out of UD transaction the system asks a "Confirmation Prompt 'Do you want to save your data first' "
    If Yes is pressed the system saves the UD transaction (ofcourse with out a UD code)  with Inspection Lot system status ICCO which will not allow the changing of results later.
    How to over come this saving of Inspection lot and changing the status ?
    Thanks
    Jomy

    Dear VRMP
    When there is a status profile which will block UD without RR and still you try to give UD and try to save the RR gets locked.  Please note that UD is not given for the lot.the status of the lot will be REL ICCO. The reason being systems automaticaly updated that inspection is completed
    I have come across this issue. I have not found a solution for this. But i have found how to unlock the inspection completion
    Go to QA11> Go to menu button EDIT> Reset > Inspection Completion> go to Edit again> Reset > Short term inspection > save> refresh the lot
    Now the status of the lot will change from REL ICCO to REL CALC. You can now do the RR & give the UD
    Hope i am clear  now
    Regards
    gajesh

  • Reasons for not enabling radio on some Lumia modle...

    Do anyone know actual reason behind not enabling Radio on some of the Lumia models (I am using 620)
    It is great if I can have radio on my phone. But with Amber update it is not happening.. 
    As I heard from other sources in 620 radio antenna is not connected to the head phone but otherwise phone is fully support for the radio. Is it true? 
    If so this may be one of a silly mistake by Nokia and Microsoft. 

    Hi Guys,
    What I am telling is no recalling of products, what I am telling is proper planing .... 
    As we know 620 has a partial hardware support for FM radio, to enable FM radio fully will it take anouther reasonable cost (not now in the designed time)? Do you think so, I don't think so
    Also it may be still posible to charge additional cost from customers and do hardware link for customers who really want it. I am not sure.
    The 620 was designed and released before the 520 and 720. 
    Yes agree but when designing they should know that that can support FM radio in the future. I guess 920 desinged pararally to the 620 and 920 has FM radio. 
    So what basically I want to emphasize is the planing of future products. I think Nokia/MS shoud do this carefully in the future. 
    Regards,
    -Lasith

  • Enhancing LBWE for not allowed fields

    Hi All,
    Has anyone ever tried to enhance LBWE structures for filling fileds which are not allowed status (F) in TMCEXCFS table.
    We need to report deliveries which are not invoiced status A)yet. So we need to enhance 2LIS_12_VCITM with VBUP-FKSTA field. I know it is possible with appending structure to the extractor and filling it via ABAP code. But field status is F in the TMCEXCFS table.
    Thank you very much.

    Hi,
    I dont think you need to alter TMCEXCFS table.
    You can just do it the usual way as of creating an uppend structure to your datasource structure and populating the field via CMOD.
    There's been a lot of topics on the issue.
    For example you can refer to
    LOGISTIC COCKPIT - WHEN YOU NEED MORE - First option: enhance it !

  • Reason for not choosing Secure Keyboard Entry?

    I use Terminal.app regularly on Mac OS 10.5. It has a menu item in the application menu, Secure Keyboard Entry. Would there ever be any reason for _not_ choosing Secure Keyboard Entry?

    Yes, there can be reasons to not enable that setting.
    Here is some reading:
    http://www.riverdark.net/board/index.php?showtopic=439
    http://www.macworld.com/article/43776/2005/03/mayosxhints.html
    http://forums.macrumors.com/showthread.php?t=496079

  • Why zero is assigned for not a public holiday in public holiday class

    why zero is assigned for not a public holiday in public holiday class

    Are you trying to accomplish the same effect as JSplitPane.setOneTouchExpandable( false ) ?

  • Non-final variable inside an inner class - my nemisis

    I have an issue with accessing variables from an inner method. This structure seems to allow access to the text objects but not to the button object. This comes from a bit of example code that just illustrates a simple form window with text fields and buttons that read them.
    At the start of the class I have text objects defined like this:
    public class SimpleGUI extends Composite {
    Text nameField;
    Text junkField;
    // Constructors come next, etc...
    Later within this class there is a method to create some GUI stuff, and then to create a button and when pressed access and print the text to the console
    protected void createGui(){
    junkField = new Text(entryGroup,SWT.SINGLE); //Ross
    junkField.setText("Howdy");
    Button OKbutton = new Button(buttons,SWT.NONE);
    OKbutton.setText("Ok");
    OKbutton.addSelectionListener(
    new MySelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
    System.out.println("Name: " + nameField.getText());
    System.out.println("Junk: " + junkField.getText());
    And that all works fine. So within the inner class, the object junkField can be accessed nicely.
    However if I try to do the same with the button (I want to change the label on the button after it's pressed) I get errors for trying to access a non-final object in an inner class.
    I tried to handle the button similar to the text, adding this after the text defs:
         Button myButton;
    and under the println's in the inner class I wanted:
    if OKbutton.getText.equals("OK") {  OKbutton.setText("NotOK")}
    That's when I get an issue with "cannot refer to a non-final variable inside an inside class defined in a different method"
    Now, if I move the button declaration into the createGui method, and declare it with "final Button myButton" it works.
    Why does the button need different treatment than the text?
    Is this a suitable method to make my button change it's label when pressed, or is this sloppy?

    Button is a local variable. The anonymous inner class object you create can continue to exist after the method ends, but the local variables will not. Therefore, as the error message says, you must make that local button variable final if you want to refer to it inside the anon inner class. If it's final, a copy of its value can be given to the inner class--there's no need to treat it as "variable."

Maybe you are looking for