Why doesn't this work?

test\Test7.Java:

test of the package;

public class Test7

{

public static foo (int x) Sub

{

System.out.println ("int foo test 7:" + x);

}

}

Test8.Java:

public class Test8

{

Public Shared Sub main (String [] args)

{

System.out.println ("Test8 hand");

test . Test7.foo (10); 

}

}

command line:

C:\Users\J\My Documents\java > dir Test8.*

Directory of C:\Users\J\My Documents\java

13/08/2013 10:42 220 Test8.java

1 file (s) 220 bytes

0 35,856,887,808 dir bytes free

C:\Users\J\My Documents\java > dir test\Test7 *.

Directory of C:\Users\J\My Documents\java\test

13/08/2013 10:147 03 Test7.java

1 file (s) 147 bytes

0 35,856,887,808 dir bytes free

C:\Users\J\My Documents\java > javac Test8.java

Test8.Java:8: error: cannot find symbol

test. Test7.foo (10);

^

symbol: variable Test7

Location: the class test

1 error

The change Test8.Java so that it uses an import statement allows compilation succeed:

test import. Test7;

public class Test8

{

Public Shared Sub main (String [] args)

{

System.out.println ("Test8 hand");

Test7.foo (10);

}

}

C:\Users\J\My Documents\java > javac Test8.java

C:\Users\J\My Documents\java >

Why?

Well, I just realized why it did not work. The real reason why he did not has nothing to do with any rubbish too complicated observability; My instincts were right: it must have worked, and indeed it would have worked throughout if it wasn't the fact that there is a file called test.class in the current directory.

The idea, after all, was in the error message, which, after return to this issue tonight and trying to solve the question damned again, I suddenly comes on:

C:\Users\J\My Documents\java > javac Test8.java

Test8.Java:8: error: cannot find symbol

test. Test7.foo (10);

^

symbol: variable Test7

Location: the class test

1 error

Huh, Test7 variable in the testclass?  That could mean maybe?  Why the compiler complains a class called test when it is supposed to be a package?  Well, it was the test.class that the compiler has been conclusive file and of course when she concluded test.class assumed which corresponded to the call of 'test. Test7.foo ()' in Test8.java and does not consider this criterion might be a package and Test7 a class within this package. God knows how he got there, but he happened did and he managed to screw up my compilation and cause a lot of grief.

So, ultimately it had nothing to do with the observability and diagnose the cause of the problem does not need a complex understand the JLS based on a bunch of definitions on observability and paragraphs JLS, the package java.util, java package, java.io, sub-packages and others like.

Everything I thought about how it should be was right - you should be able to use an import statement or a full qualified class reference. It should not make a difference either. It is the convenience of a programmer to use import instructions. It is not mandatory for references to classes in your own packages to include an import statement in your .java file. I am happy to say I stuck to my guns in the face of hostile enemy fire and refused to be intimidated by explanations that comes, for me, has no meaning.

Please take note chaps, especially my good friend cardan2 and disciple and my very good friend masijade, I at no time has received a solution to this problem either here or 'the other place '.

Problem solved

Tags: Java

Similar Questions

  • Why doesn't this hitTestPoint work?

    Probably I'm missing something on which settings I'm supposed to be in the way.

    Here is the code:

    In the first class (the object hit belongs to this class):

    gp.lockPiece (e.stageX, e.stageY);

    In the second class (referred to above as gp, the object to be affected belongs to this class):

    public void lockPiece (gx, gy) {}
    If (this.hitTestPoint (gx, gy, true)) {}
    this.isLocked = true;
    this.gotoAndStop ("Lock");
    trace (this.isLocked);
    }
    else {}

    trace ("failed.");
    }
    }

    It traces always "did not work" when I drag the instance of the class from the instance of the second class first. As I understand it not on the function hitTestPoint?

    What is highlighted could be added to a table and every time you check your hittest, check if each element of the array is hit.  If this is not the case, turn off highlight it.

  • Simple question - why doesn't this long text vertical field?

    It must be easy, but I spent too long trying to make it work.  I have a screen that displays a long string (EULA), followed by a few buttons.  I can not get the vertical scrolling text.  What Miss me?  I tried different combinations of indicators on the Manager with no luck.    I tried to use a LabelField as a RichTextField.

    Thank you!

    Here is the constructor for the form class:

     public EULAScreen() {
    
            super();
    
            VerticalFieldManager mgr2 = new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.USE_ALL_HEIGHT);
    
            mgr2.add(new LabelField("Scroll to the bottom and click I AGREE to accept this agreement.\n \n"));
            lbEULA = new RichTextField(EULATEXT,RichTextField.USE_ALL_HEIGHT);
    
            mgr2.add(lbEULA);  // lbEULA is a multi-line private static final String
            mgr2.add(acceptButtonField);
            mgr2.add(notacceptButtonField);
            add(mgr2);
        }
    

    Try something like below:

    //main screenpublic EULAScreen(){   super(NO_VERTICAL_SCROLL);   VerticalFieldManager mgr2 = new        VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.VERTICAL_SCROLLBAR)   {      protected void sublayout( int maxWidth, int maxHeight )       {          int displayWidth = Display.getWidth();          int displayHeight = Display.getHeight();
    
               super.sublayout( displayWidth, displayHeight);           setExtent( displayWidth, displayHeight);       }   };   mgr2.add(new LabelField("Scroll to the bottom and click I AGREE to                  accept this agreement.\n \n"));   lbEULA = new RichTextField(EULATEXT,RichTextField.USE_ALL_HEIGHT);
    
       mgr2.add(lbEULA);     // lbEULA is a multi-line private static final String    mgr2.add(acceptButtonField);    mgr2.add(notacceptButtonField);   add(mgr2);}
    

    @Edit: typo

    Concerning

    Bika

  • Why won't this work?

    I started a Microsoft account for my Windows laptop, 8. Then, I changed the primary alias to a different email address. I tried to add my previous as an alias account so that I could do the primary alias. Did not work. He said that it was already used. How can I get this back to the original address?

    Thank you

    KelseyE

    There is at least a day 30 Security hold until you can do it.  After that, you should be able to.

  • I have a MacBook Pro 2013 and installed from a disc of Lightroom 3.  I enter my serial number and it tells me it's wrong.  Why won't this work?

    I bought the product, have a serial number, and when I go to install from a superdrive drive, he told me that my serial number is not valid.  I have a MacBook Pro 2013 and it running Yosemite 10.10.5

    Thank you much for the help!

    Jericho

    Please see the links below.

    Hope this will help you.

    Kind regards

    Hervé Khare

  • Why doesn't AE work on my mac osx 10.9.3, please help

    I am on mac osx 10.9.3 and AE settles it, CS5, CS6 or CC, they all won't let me open the software after I install it, please help!

    Install the update;

    http://Adobe.LY/AE_CC_1201_Mavericks

  • Why doesn't my password work?

    I signed up for an account in the last 30 minutes. I chose a password and confirmed. Then I went to the Android store to download Firefox for Android on my phone - and it has worked successfully. But when I tried to login, my password was rejected. I checked to make sure it was the same thing, and it is. Why doesn't my password work? Oh, and it is 9 characters long with two digits.

    In addition, I tried to change my password of Firefox on my desktop PC to be rejected for the same problem. So I can't even change my password (it takes the old password).

    Password for what?
    This forum?
    The synchronization service account of Firefox?
    Or?

  • I just installed acrobat adobe 7.0 standard and everything seems to go well except it doesn't have the option of the typewriter in the section tool like my previous installation. This is a very important feature for me how this works?

    I just installed acrobat adobe 7.0 standard and everything seems to go well except it doesn't have the option of the typewriter in the section tool like my previous installation. This is a very important feature for me how this works?

    Hi timr22708473,

    Acrobat 7 is really an old version of acrobat & might not be compatible with your system configuration to features may or may not work.

    This is the reason why Adobe recommends always using the application in a consistent environment.

    Kind regards

    Nicos

  • I have a Dell Inspiron 531, I can't Panda titanium to download when I put in the disk drive. Why the habit of this work? I don't have an error message, but my computer says that there is a threat in my computer.

    I have a Dell Inspiron 531, I can't Panda titanium to download when I put in the disk drive. Why the habit of this work? I don't have an error message, but my computer says that there is a threat in my computer.

    http://www.pandasecurity.com/homeusers/support/

    Link above is Panda Support for installation issues, etc...

    http://support.pandasecurity.com/Forum/

    Forums of users Panda at the link above.

    They will help the Panda support above links.

    See you soon.

    Mick Murphy - Microsoft partner

  • I copy student PS CS6 which works fine except when I'm disconnected from online, why is this and what can I do to make this work if the connection is lost. In addition, everything will work OK if I update to Windows 8 for windows 10?

    I copy student PS CS6 which works fine except when I'm disconnected from online, why is this and what can I do to make this work if the connection is lost. In addition, everything will work OK if I update to Windows 8 for windows 10?

    Yes, Photoshop should work fine without the internet connection, as this is the standalone version.

  • Why doesn't it let me get in there - my subscription is paid and up-to-date. Photoshop works. I HAVE EF

    seriously. It is called, time and people. This is UNACCEPTABLE!

    my subscription has not been renewed. Why should I pay so much per month and cannot 'chat' with an ADOBE REPRESENTATIVE to solve this problem? WTF. I guess that most of the others use this work. PEOPLE FROM WORK. It's more embarrassing. I AM lack of TIME for THIS reason SH * TTY SERVICE.

  • gotoAndPlay: why the habit of this work - it should be simple!

    Why does this work:

    gotoAndPlay ("CS1_2A");

    but this is not:

    var destFrame:String = "CS1_2A";
    gotoAndPlay (destFrame);

    var destFrame:String = "CS1_2A";
    _root. gotoAndPlay (destFrame);

  • Why is this work not running?

    Why is this work not running?
    SQL> BEGIN
      2  DBMS_SCHEDULER.RUN_JOB('EXCHANGE_PART_JOB');
      3  END;
      4  /
    BEGIN
    *
    Error in line 1:
    ORA-00911: invalid character.
    ORA-06512: in "SYS.DBMS_ISCHED", line 150
    ORA-06512: in "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: in line 2
    This work follow these steps:
    CREATE OR REPLACE PROCEDURE Exchange_Partition IS
    Sql_Exchange VARCHAR2(2000);
    BEGIN
    Sql_Exchange := 'ALTER TABLE HR.GPS_LOG_HIS EXCHANGE PARTITION '||
    'udp_part'||TO_CHAR(SYSDATE-1/24,'YYYYMMDDHH24')
    ||' WITH TABLE HR.GPS_LOG';  
    EXECUTE IMMEDIATE Sql_Exchange;
    END;
    /
    Use the following program:
    BEGIN
      DBMS_SCHEDULER.create_program (
        program_name        => 'exchange_part_prog',
        program_type        => 'STORED_PROCEDURE',
        program_action      => 'EXCHANGE_PARTITION',
        --Use a database directory to replace the OS directory.
        number_of_arguments => 0,
        enabled             => TRUE,
         comments            => 'Program to exchange partitions for hr.gps_log_his table or other tables
                                 use a shell script.');
    END;
    /
    Use the following code to create the work:
    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name      => 'exchange_part_job',
        program_name  => 'exchange_part_prog',
        schedule_name => 'exchange_part_hourly_schedule',
        enabled       => TRUE,
        auto_drop     => false,
        comments      => 'Job defined to exchange partitions for gps_log_his table or orhter tables.');
    END;
    /

    Ok

    ORA-14099: all rows in the table are not eligible for the specified partition
    Cause: There is at least one line in the non-partitioned table which does not qualify for the partition specified in the PARTITION of EXCHANGE ALTER TABLE
    Action: Ensure that all the lines in the segment qualify for the partition. Perform the operation table alter with the NO CHECK option. Run ANALYZE table VALIDATE on that partition, namely the invalid rows and delete them.

    I think you should check the data in gps_log, some lines must belog to another partition?

    Concerning
    Peter

  • Why personas do not work with all themes?

    Why personas do not work with all themes?

    Not all personas work well with a custom theme, the developers of Firefox have decided to return to the theme by default if you install a character.

    A theme can allow personsas with this line in the install.rdf file, as does the default theme.

    • < em: skinnable > true < / em: skinnable >

    So if a theme doesn't work with a character then skinnable is not enabled.

  • Is - will this work with Thunderbird V.29 Beta lightning?

    I tried to install Lightning via the function "get module", and he let me. I restarted, and the timetable given. but when I tried to create "new" or "new missions", all the commands to create new tasks/events appear in gray and do not work. Is - will this work with TB V.29 Beta lightning? If Yes, what should I do to get the grayed out 'new tasks/events' orders for work? If it is not fully operational with TB V.20 beta, why it let me install the add-on (who appears intuitive)?

    Versions of Thunderbird are still based on Tb 24 because the current is 24.5.0 as to why version 2.6.4 is served on https://addons.mozilla.org/en-US/thunderbird/addon/lightning/

    Beta-testing of Thunderbird builds that are built to a fine QA, to the appropriate version of lightning as it is for 29,0 Tb 3.1b1.

Maybe you are looking for

  • The Add-ons Manager does not load

    I want to install McAfee siteadvisor, but I can not load the add-on Manager. I have win7 firefox6. I have the program on my computer and it works fine in Explorer.

  • Satellite A100 - strange battery issue

    My battery takes more than two or three days to load completely, but when the cord is pulled it will not provide any power. My research has led me to believe it could be a bad battery, or BIOS related. Anyone have similar problems? Any help much appr

  • Preferences of the keyboard in the different Yosemite of Mavericks?

    I have a friend that I am trying to explain the various keyboard options. I have the Mavericks, and he has Yosemite. As usual everything we are discussing, he insists that everything works differently in Yosemite from how it does in the Mavericks, an

  • WRT610N does not

    Hello I tried for 2 days to get to our new WRT610N wireless router to connect to our network and allow people to connect wired and wireless network. I searched through many forums and other sites to find answers, but somehow, nobody knows. Scheme of

  • Transfer of file photo from computer to the external device, not a cd - card type

    file transfer to computer photo bin plug external peripheral