Question about scope in the enum example in the Java Tutorial

Hi,
On page http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html of the Java tutorial the enumeration MONDAY is not prefixed with the enum name when it is used in the function tellItLikeItIs.
public class EnumTest {
     Day day;
     public EnumTest(Day day) {
          this.day = day;
     public void tellItLikeItIs() {
          switch (day) {
               case MONDAY: System.out.println("Mondays are bad.");
                              break;
               case FRIDAY: System.out.println("Fridays are better.");
                              break;How does the compiler know that MONDAY is the same as Day.MONDAY? Is it because of
switch(day)Then later in the main MONDAY must be prefixed with Day. I removed Day. and it did not compile. Why is Day. necessary in main but not in tellItLikeItIs?
public static void main(String[] args) {
          EnumTest firstDay = new EnumTest(Day.MONDAY);
          firstDay.tellItLikeItIs();Thank you.

swtich is a special case.
The label for each 'case' of a switch
will infer based on the type of switch value
switch(d) {
case MONDAY:
case TUESDAY:
will automatically refer to the MONDAY and TUESDAY
corresponding to d's type.

Similar Messages

  • Question about scope!!

    Hi ~
    I have a question about scope.
    for example
    primitive character variable ("char")
    what is principle upon which it is based?
    How can scope implemented?
    Please explain at low level in detail..
    thanks

    Scopes are related to braces (and the for+catch-statements).
    Inside a function nested scopes of the same name are forbidden {int x; {int x; ... } ...}, as misunderstanding could arise.
    You may mention a name (method name, class name, var name), before its declaration, like:
    int f() {x = 3;} int x;Implementation issues address variable locations on the stack and heap management (garbage collection), and exceptions (stack unwinding).
    If you are interested in compiler construction try the javap tool, and try out the JVM, by for instance writing a compiler to JVM byte code.
    To answer your question on variable clean-up: I'm afraid while playing compiler you need to calculate var addresses/frame sizes, and calls/stack frames are a bit confusing, but the rest is easy.

  • Question about setup_MITE in the PCI-MIO-16E-1

    I have a quick question about setup_MITE in the PCI-MIO-16E-1. In one of the manuals, it states that if you're using Dell Optiplex GX series for our hardware configuration, is it true we need to re-write the MITE functions to correlate with the hardware? Please if you can clarify what this means, I would really appreciate it. Thank you in advance.

    National Instruments is starting a new newsgroup to provide a forum for customers to discuss register level programming issues and ask questions. This newsgroup is not a direct support channel for register level programming, but may be monitored by National Instruments engineers. Please post you question with additional detail in:
    natinst.public.daq.driver-development.general
    Christian
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • Another BW question about filter in the query definition

    Hi ,
    I have another question about filter in the query definition.
    <u>Question:</u>
    Which of the following objects can be filtered in the query definition?
    A. characteristic
    B. Key figure
    C. Structure
    D. Units
    E. Hierarchy
    My answer is A,B,D,E.
    The answer in the book is A,B,D
    Can anybody tell me which one is wrong?
    Thanks in advance,
    Liu Jia

    HI
    1.The answer could be A,B,D.you can not apply filters on hierarchies
    2.Whenever there is a change in Attribute data(like Location,Num etc...)that has to be reflected in all aggregates of the cube.Thsi can be done by running "ATTRIBUTE CHANGE RUN".
    sri

  • Question about Logon ticket with user mapping at BI-JAVA environment

    We're implementing BI 7.0 including BI Java and SAP EP for end user
    access.
    I have two question about SSO method when we're using BI Java.
    I know we can simply configure SSO logon ticket with BI-Java(EP
    included) and BI-ABAP through BI template installer and we already
    succeeded in that case.
    But the problem is we want to change it to user mapping SSO method for
    some our internal reason.
    After we configure user mapping SSO, we've got SSO failed error when we
    call BI-Java stuff like BEx Web Application iView.
    After many testing implemented, we found SSO Logon ticket with user
    mapping (using SAP reference system). It seems working now.
    But our question is "Is it no problem when we use SSO logon ticket with
    user mapping?" Is there any restriction or issue?
    One more question is we can ONLY use user base mapping when reference
    system used. How can we assign BI-ABAP users to EP Group?

    Using an SAP Reference system is allright. But if the reason u r going for this is because of different usernames in EP and BI, why dont you go for user mapping.
    Anyways, on restriction of reference syetms is that you can have ONLY ONE reference system defined in portal. In you case you can only have the BI system defined.
    Hope this helps!!

  • I'm stuck! Following the Java Tutorial

    I'm confused :=Q
    I am following the Java tutorial and am trying to do the ClickMe applet. The html file was saved as text in notepad. I downloaded the ClickMe and Spot source files. They compiled without errors along with the html file. I double checked my DIR and saw that I had the class files. When I went to run the applet, the little window appeared without any spot and said something about Clickme class in the heading border and then in the box it said applet not initialized. So, I went through the forum and looked for anything similar and I saw that someone said to compile like:C:\jdk1.3.1_01 javac ClickMe.java Spot.java
    So, I tried that, and I still have class files, but now I don't have the applet box showing anymore and I don't get any errors. I was successful when I did the Hello World applet, so I know it's not a class path problem or text prob. I was using typing appletviewer ClickMe.html
    I'm getting so hungup on trying to get the applets to work I am losing track of how and why they are supposed to work. It is so discouraging especially when there doesn't seem to be anyone in particular to ask.
    Does anyone have anything encouraging to offer?
    I am using JDK 1.3 on WinXP (Java has been totally enabled without using the plug in) It has worked successfully.
    Thanks in advance once again for your help.
    Karen

    I'm learning with the tutorial also ;)
    Makes about 3 months I'm doing so, and from my experience, it is much more fun to create Programs than Applets.. I always work with Swing and it is a pain to use it inside Applets (but Swing is really great to create GUIs..) Learning how to build Jar and how to use Swing helps you building up Jar files that run like EXEs ;) That gives good results!

  • The Java Tutorial

    Does The Java Programming Language, Third Edition include the contents of The Java Tutorial, Third Edition: A Short Course on the Basics ?

    Contact the Documentation Team

  • A question about some of the features

    I have Vista so therefore am unable to use the trial version of photoshop elements. Before I go ahead and purchase the software, I had a few questions about its features.
    I'll mainly be using photoshop to create digital scrapbooks. I know that photoshop comes equipped with themes and images, but I would like to know if I can use my own backgrounds and images. If I am able to use my own backgrounds, can they tile?
    Another thing I would like to know is if I can create my own projects with custom dimensions.
    Lastly, I'll be using photoshop to sprite. Is elements well suited for spriting? More specifically, does it have a color selection/replacement tool?

    I use PSE for digital scrapbooking. Instead of using the "built in"
    creations and albums, just create your own PSD files with layers of
    whatever images/embellishments/background papers you want. You can
    specify whatever size of creation you want when you create your PSD file
    (you only have the choice of certain sizes when you use the built in
    stuff).
    Not sure about what you mean about making your backgrounds tile, but I
    think it is possible. You can take a "background" paper, do a selection,
    and then define a pattern and fill it. Or, if you mean layer your
    background papers - yes you can do that too. (Here is my online
    scrapbook pages, all of which were done in PSE 4 or 5:
    http://www.scrappersguide.com/forums/gallery/showgallery.php?cat=500&ppuser=413)
    You can select by color (using the magic wand tool) and you can replace
    color, but it may not work exactly as you expect. (I also don't know
    what spriting is.) But, many people just use a hue/saturation adjustment
    layer to change colors.
    -Trish

  • Question about Run-Time Shortcut Menus example

    I am looking at the Run-Time Shortcut Menus.vi that ships with LabVIEW2011. There is an event case "Test List":Mouse Down that does nothing but generate a Val(Sgnl) event for the "Test List" control if the right mouse button was pressed. There is no value change event for that control.
    Is there an obscure reason to do that? One thing I have learned about many of the examples is not to strictly use them as examples.
    =====================
    LabVIEW 2012
    Solved!
    Go to Solution.

    Nevermind - I found the obscure reason. Even though there is not a value change event, generating the value change event is required to change the value on right-click.
    At least NI could have documented this in the example
    =====================
    LabVIEW 2012

  • Extracting specific detial about class from the JAVA API created by Javadoc

    hi ,
    Bacialy I need to get detials of all classes from the Java packages for my project. So i thought getting detials from the Java API document might be one way of doing it. If any one tell me some package or software which can get particulat text from the API document that will be great.
    Thank you,
    Raj

    Hi,
    I think, much easier way would be to write a little doclet. That doclet would take the information you need directly from the Doclet API and generate by it a plain text with the content you wish (for instance, as an SQL script that loads everything into a certain database).
    Obtaining this from the generated HTML documentation just adds one extra step (and a lot more complicated, by the way).
    Also, you can avoid even writing a doclet.
    There is a tool called DocFlex/Javadoc:
    http://www.filigris.com/products/docflex_javadoc/
    It is a template-driven doclet, which can be easily programmed to do the job. (However, a license will be needed).
    Regards,
    Leonid Rudy
    http://www.docflex.com

  • Need help understanding a line of code from the Java Tutorial

    Here is the code I have seen in the Reflection Tutorial:
    import java.lang.reflect.*;
    class SampleInvoke {
       public static void main(String[] args) {
          String firstWord = "Hello ";
          String secondWord = "everybody.";
          String bothWords = append(firstWord, secondWord);
          System.out.println(bothWords);
       public static String append(String firstWord, String secondWord) {
          String result = null;
          Class c = String.class;
          Class[] parameterTypes = new Class[] {String.class};
          Method concatMethod;
          Object[] arguments = new Object[] {secondWord};
          try {
            concatMethod = c.getMethod("concat", parameterTypes);
            result = (String) concatMethod.invoke(firstWord, arguments);
          } catch (NoSuchMethodException e) {
              System.out.println(e);
          } catch (IllegalAccessException e) {
              System.out.println(e);
          } catch (InvocationTargetException e) {
              System.out.println(e);
          return result;
    }There are 2 lines I do not understand (but once I understand one, I'll understand the other).
    Here they are:
    Class[] parameterTypes = new Class[] {String.class};
    Object[] arguments = new Object[] {secondWord};Any explanation will be greatly appreciated :)

    There are 2 lines I do not understand (but once I
    understand one, I'll understand the other).
    Here they are:
    Class[] parameterTypes = new Class[]
    {String.class};
    Object[] arguments = new Object[]
    {secondWord};
    the first line simply creates an array of objects, the objects are of type Class. It then places the object referenced in the brackets into the array.

  • [EWS][FastTransfer][MS-OXCFXICS] Question about paging in the Fast Transfer Stream after exporting message and the meaning of the config in the previous section of the stream.

    Hi, all.
    First, I want to construct a fast transfer stream by programming not using the export item's stream and to import the stream to the folder by posting import request in EWS.
    So, I export the item by EWS and investigate the exporting stream's struct by reading the [MS-OXCFXICS].pdf. And I can parse each MAPI property, marker, meta-property from the stream.
    I find that the stream is made of many pages, most page's length is 0x7BC0, some are less then 0x7BC0. And in the previous section of the stream, there are some configurations. So the questions are:
    1. What is the paging rule? or What is the principle of the paging? Whether a complete propvalue/marker(ref from [MS-OXCFXICS].pdf) must be contained in a page except some binary type?
    2. Why the page's binary length is 0x7BC0? Or where is the configuation about paging length?
    3. The stream is made of the FXOpcodes and the subbuffer about the FXOpcodes, and I find the mean of the FXOpcodes:
    internal enum FxOpcodes
    None = 0,
    Config = 1,
    TransferBuffer = 2,
    IsInterfaceOk = 3,
    TellPartnerVersion = 4,
    StartMdbEventsImport = 11,
    FinishMdbEventsImport = 12,
    AddMdbEvents = 13,
    SetWatermarks = 14,
    SetReceiveFolder = 15,
    SetPerUser = 0x10,
    SetProps = 0x11
    and in the stream there are 4 part(after I parse the stream):
    A. OpCode:Config, value:0000000001000000
    B. OpCode:IsInterfaceOk, value:010000000703020000000000C00000000000004600240080
    C. OpCode:TellPartnerVersion, value:000F91838417
    D and follows is: OpCode:TransferBuffer, Count:31680
    So 
    a. What is the OpCode:Config value meaning?
    b. Some parts of The OpCode:IsInterfaceOk' value is the IID_IMessage("00020307-0000-0000-C000-000000000046"), What is other parts meaning?
    Thanks in advance for any ideas.

    Hi Haiyang,
    Your questions are not covered by the Open Specification documentation and this is documented in [MS-OXWSBTRF] — v20141018 section “1.3 Overview”.
    The upload and export data stream is an opaque format that only needs to be understood by a server implementation. The client only serves as a repository for the opaque data stream so that it can be uploaded to the server at
    a later time.
    You made good progress in interpreting the buffer using other documents. Why do you need to be able to parse the data? Please describe your project in details and I might submit a suggestion to document the layout of the data stream,
    if your project justifies it. You can send the description directly to me.
    Thanks, Vilmos

  • [EWS][FastTransfer] Question about paging in the Fast Transfer Stream after exporting message and the meaning of the config in the previous section of the stream.

    Hi, all.
    First, I want to construct a fast transfer stream by programming not using the export item's stream and to import the stream to the folder by posting import request in EWS.
    So, I export the item by EWS and investigate the exporting stream's struct by reading the [MS-OXCFXICS].pdf. And I can parse each MAPI property, marker, meta-property from the stream.
    I find that the stream is made of many pages, most page's length is 0x7BC0, some are less then 0x7BC0. And in the previous section of the stream, there are some configurations. So the questions are:
    1. What is the paging rule? or What is the principle of the paging? Whether a complete propvalue/marker(ref from [MS-OXCFXICS].pdf) must be contained in a page except some binary type?
    2. Why the page's binary length is 0x7BC0? Or where is the configuation about paging length?
    3. The stream is made of the FXOpcodes and the subbuffer about the FXOpcodes, and I find the mean of the FXOpcodes:
    internal enum FxOpcodes
    None = 0,
    Config = 1,
    TransferBuffer = 2,
    IsInterfaceOk = 3,
    TellPartnerVersion = 4,
    StartMdbEventsImport = 11,
    FinishMdbEventsImport = 12,
    AddMdbEvents = 13,
    SetWatermarks = 14,
    SetReceiveFolder = 15,
    SetPerUser = 0x10,
    SetProps = 0x11
    and in the stream there are 4 part(after I parse the stream):
    A. OpCode:Config, value:0000000001000000
    B. OpCode:IsInterfaceOk, value:010000000703020000000000C00000000000004600240080
    C. OpCode:TellPartnerVersion, value:000F91838417
    D and follows is: OpCode:TransferBuffer, Count:31680
    So 
    a. What is the OpCode:Config value meaning?
    b. Some parts of The OpCode:IsInterfaceOk' value is the IID_IMessage("00020307-0000-0000-C000-000000000046"), What is other parts meaning?
    Thanks in advance for any ideas.

    OK. Thank you.
    Today I build a stream with a paging rule as below:
    1. Keep each page's byte length is 31680.
    2. Make sure a complete property value in a page except binary type property whose value length is larger
    than 31680.
    And it can work very well when import the stream to the folder by EWS.

  • Question about shutting down the middle tier while leaving the DB up

    Hi,
    We just successfully upgraded 11.5.10.2 from running on 9.2.0.8 SOLARIS SPARC 32-bit to 11.2.0.1 SOLARIS SPARC 64-bit.
    I am in the process of rewriting the backup scripts. We used to do a once-a-week backup (zip) of the middle tier directories,
    after shutting down EVERYTHING cold (MT first, then DB listener, the DB). Our DB consultant likes hot-only backups of the
    DB so we are going to keep the DB running all the time and always do hot backups from the DB, but keep MT cold backup.
    We want to keep our MT cold backup so we retain our downtime window that users expect (Saturday night - Sun morning).
    So my question is ---- is there any issue with shutting down the entire MT- only (adstpall.sh) -- but leaving the DB up?
    When I do a adstrtal (via my script) the next morning--- everything should just start fine with no DB bonce having been done, right?
    In the past, once I have the MT down, wait 5 min, kill any stray FND processes, I usually go on to bounce the database
    "for good measure". I am 99% sure that I don't have to do this... and that there is no harm in "not" doing this, just need
    some confirmation.
    MH
    One more piece of information - Our concurrent managers shut down cleanly almost all of the time without putting jobs on hold.
    We don't have many users (< 60) and while we do have autoinvoice that runs every 5 min, I haven't had to do a big bounce
    with cmclean.sql very often-- only about once or twice a year when users lock each others tables and the cleanest fix is to bounce
    everything --very rarely.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    So my question is ---- is there any issue with shutting down the entire MT- only (adstpall.sh) -- but leaving the DB up? There should be no issues.
    When I do a adstrtal (via my script) the next morning--- everything should just start fine with no DB bonce having been done, right?Correct.
    In the past, once I have the MT down, wait 5 min, kill any stray FND processes, I usually go on to bounce the database
    "for good measure". I am 99% sure that I don't have to do this... and that there is no harm in "not" doing this, just need
    some confirmation.You still need to wait for sometime for the CM to shutdown, that's all.
    One more piece of information - Our concurrent managers shut down cleanly almost all of the time without putting jobs on hold.
    We don't have many users (< 60) and while we do have autoinvoice that runs every 5 min, I haven't had to do a big bounce
    with cmclean.sql very often-- only about once or twice a year when users lock each others tables and the cleanest fix is to bounce
    everything --very rarely.You should be OK with your approach.
    Thanks,
    Hussein

  • Why can't someone from apple answer my question about upgrading to the current version of Itunes

    I am amazed that I have been posting questions for months about this issue and no one has given me an answer!!!!  Does Apple not track these discussions?
    I have Windows 7 64-bit and am trying to upgrade Itunes to the current version, with no suggestions.
    I have found and tried the 64-bit installer and receive the following message:
      'This itunes installed is intended for 32-bit versions of Windows. Please download and install 64-bit Itunes installer instead.'
    I have itunes 9.1.1.12 currently installed.

    Okay ... it's behaving just like the PC Mover thing. 32-bit versions of iTunes and AMDS have somehow been jammed on the PC. When you go to uninstall either of them, the 64-bit Windows installer service encounters 32-bit installation configuration information, goes into a fantod, and you get the error message.
    So we'd better try clearing away that installation configuration information, and then trying another update.
    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any Apple Mobile Device Support entries and click "Remove", as per the following screenshot:
    Next, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

Maybe you are looking for

  • I am trying to restore a backup on my iphone

    but cannot because it asks me to turn off find my phone - which is greyed out.

  • Simultaneo​us but Separate tasks in VI Logger

    Hello, We have two tools (A & B) that used to both send a signal to a PCI-6032E data acquisition board. The signal was being logged in VI Logger through a Traditional DAQmx task (we were using the version 1.1.1 of VI Logger). We had two separate VI L

  • Essbase Error 1013009 - Administrator Has Temporarily Disabled User Command

    Hi guys, I'm trying to load an outline from one server to another server. But during the restructuring process, I encountered the error "Essbase Error 1013009 - Administrator Has Temporarily Disabled User Commands". What does this error mean? How can

  • ODI-1228: Task SrcSet0 (Loading) fails on the target ORACLE connection

    Hi all. I am using ODI for the first time. Trying to import a flat file data into Oracle table. Flat file has 4 columns Empno,Ename,Deptno,Salary [2 rows] so is the Target Table in Oracle [All are VARCHAR2 data type] --Empty table I am using these KM

  • To move function group to TQA

    hi tehre was  a short dump in qas sysatem and i forun that reason wa that the function group zfi creted as in tdv did not moved to QAS not i dont hvae any idea reagrding what changes done to that function group and i can see that function group in td