Compiling simultaneously two classes referencing each other

Hi,
When we want to compile 2 classes simultaneously in a package, we give command --
javac package-name/*.java
Suppose the two classes are ClassA and ClassB and ClassA has a reference of ClassB. So the compiler will finish compiling ClassB before compiling ClassA.
But, if both the classes have each others' reference, how does compiler resolve this? Because, even in that case both classes get compiled
Regards,
Amit

Lets say that compilation is done in 2 steps.
The first step is done for all files first.
Then the second step is done for all files.
That means that for the second step the compile-time resolution has takes place.
Two classes that refers to each other must go through the first step in
the same compilation so that in the second step when
they are referring to each other they are easily resolved.
This is different from runtime resolution.

Similar Messages

  • Problems with classes referencing each other...

    I've got a problem....i have a program with two classes, and each class needs access to methods stored in the other class.
    I've tried to create a reference (Classname name=new Classname();), but upon execution, i get a Exception in thread "main" java.lang.StackOverflowError, and a long list of locations, all pointing to the references i created at the top of each class.
    What's wrong, and how do I fix this?

    You have infinite recursion. A method or constructor is calling itself, or is calling another method or constructor that eventually ends up calling the first one.
    If you can't find it, post code. Use [code] and [/code] tags, which you can get with the code button, to make the code readable.

  • Can two functions call each other?

    I'm converting some code and have run into two functions that call each other. While I seem to have converted both functions to plsql ok, they do not compile, seemingly because they ref each other. As soon as I de-reference one one function's call to the other function they both compile.
    I know that Oracle 10g supports recursion; and on the surface of things, this situation does not seem much different than recursion. If both functions are well formed, I would hope that they'd compile.
    I wasn't able to find much by searching the forums on this topic...but I'm hoping that someone will have some info on this issue.

    what happens when f2 sends 2 as parameter to f1 (i mean F1(2) in place of f1(1) ) at line 6 of f2).probably that what you expected ;) :
    SQL>  create or replace function f1 (i integer default 0)
         return integer
    as
    begin
         dbms_output.put_line ('In function f1');
         return case when i != 1 then f2 end;
    end f1;
    Warning: compiled but with compilation errors
    SQL>  show error
    Errors for FUNCTION F1
    LINE/COL ERROR                                                           
    6/31     PLS-00201: identifier 'F2' must be declared                     
    6/2      PL/SQL: Statement ignored                                       
    SQL>  create or replace function f2
         return integer
    as
         i integer;
    begin
         dbms_output.put_line ('In function f2');
         execute immediate 'begin :1 := f1(2); end;' using out i;
         return i;
    end f2;
    Createfunction successfully completed.
    SQL>  select f2() from dual
    select f2() from dual
    Error at line 1
    ORA-00036: maximum number of recursive SQL levels (50) exceeded
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8
    ORA-06512: at "MICHAEL.F1", line 6
    ORA-06512: at line 1
    ORA-06512: at "MICHAEL.F2", line 8

  • How do I view two clips overlapping each other, each being semitransparent to see both at the same time, so that I can decide where to stop of the first clip and start of the second clip? Thanks.

    Basically I want to combine to clips with correct timings. For that I want to view the two clips overlapping each other, each being semitransparent to see both at the same time, so that I can decide where to stop of the first clip and start of the second clip? Thanks.

    see my reply in your other post:
    You're familiar with the TRIM-tool?
    http://help.apple.com/finalcutpro/mac/10.1/?lang=en#ver1632caff
    http://help.apple.com/finalcutpro/mac/10.1/?lang=en#ver1632d8e4
    http://help.apple.com/finalcutpro/mac/10.1/?lang=en#ver1632d9ae

  • Link two LRT224 with each other using VPN

    What's the best way to connect two LRT224 with each other, which are in two different citys?
    Open VPN or IPSec?
    I think Gateway to Gateway should be the right mode, but I am very unsure with the lot of settings ...
    Solved!
    Go to Solution.

    Try the EasyLink VPN feature of LRT214/LRT224, which simplifies the site-to-site VPN setup.
    http://kb.linksys.com/Linksys/ukp.aspx?vw=1&docid=03cf456383fc4d958cf918110c7fcd42_How_to_configure_...
    EasyLink VPN works in the following way conceptually.
    1. At the primary site, enable EasyLink VPN Server (inbound tab on the Web GUI) and create an account (username/password) for each remote site.
    2. At a remote site, enable EasyLink VPN Client (outbound tab on the Web GUI), and enters the matching account credentials (username/password).
    3. The remote site will automatically reach out to the primary site to establish an IPsec tunnel.
    Note: LRT224 can support up to five EasyLink VPN peers in a star VPN topology.

  • Hello , I have a shot with two lips kissing each other , how can I keep

    Hello , I have a shot with two lips kissing each other , how can I keep the lips red and turn the rest of the face into black ? I tried shaping but the result was negative because the shape was moving all teh time , I tried color correction but the face and lips`s color was similar so I couldn`t do it with that , is there any other way ? Thanks so much

    You're gonna have fun with this because the HSL qualifiers probably won't see much separation between the areas that you want to isolate. You could try combinations of turning off Hue, Saturation, or Luminance. See what you get.
    Otherwise you're into a roto. (Manually tracked and animated User Shape)
    jPo
    Message was edited by: JP Owens

  • Both disc drives broke within two weeks of each other?

    I bought an imac and macbook pro about a year and a half ago and within two weeks of each other, both have broken. They have always been awkward to insert/eject disc to/from, but now they either don't accept discs in or wont spit them out. Surely this isn't coincidence as they get very different usage from each other. Also, i've just upgraded to 10.6.8. Is this a known problem? Can i request Apple fix these issues for free, as i don't really feel one and a half years is acceptable for the breakdown of both machines, especially as they get very little usage.
    Advice?

    AppleCare covers you for three years.

  • Run two counters simultaneously with out affecting each other

    Hi
    I am new to labview. I am trying to figure out how the two counters/ timers( one is nongateable standard timer and another is standard timer which is software based) run simultaneously. I created it in different while loops. Is it possible to create two counters in single loop with out affecting each other?

    Hi Pavani,
    Welcome to the forums!  As a new LabVIEW user there are many helpful resources out there to get you started.  I would like to point you to the two links in my signature.  The first is a six hour LabVIEW course and the second helps you learn DAQmx.  Also take advantage of the shipping examples.  When you open LabVIEW select Find Examples to open the Example Finder.  Assuming you are using DAQmx, you can go to Hardware Input and Output>>DAQmx>>Counter Measurements and find many useful example programs that either do what you want or can be modified to perform the task you desire.
    To answer you question, two counters in the same loop do not affect each other.  The counters will gather data separately.  By putting them in the same loop, you just perform the reads in software at the same time.
    Regards,
    Ima
    Applications Engineer
    National Instruments
    LabVIEW Introduction Course - Six Hours
    Getting Started with NI-DAQmx

  • Can these two attributes conflict each other?

    A Data Guard question: Can MAX_FAILURE and NET_TIMEOUT attributes conflict each other if we configure them simultaneously on a same LOG_ARCHIVE_DEST destination?
    Is there any overlap to them?

    Is it easier to ask someone else to look up the
    answer for you than to look it up yourself?
    http://www.oracle.com/pls/db111/homepage
    I encourage you to read it for yourself. You might
    just learn something else of value.
    Read the Doc - A Poem
    I need a guru who can do
      In one statement - a line or two,
    To write for me the fix i need
      to make me a hero, o yes indeed.
    I hack and I paste, can't show my true code
      But using your powers I'm sure you will know
    What is my issue, time is flying -  Tick-Tock...
      What do you mean, just go read the doc? RTFM - right? ;}

  • Two JTables changing each others data

    I have the following swing setup:
    JPanel mainPanel with GridLayout(0, 1)
    JPanel tablePanelA with BorderLayout
    JPanel tablePanelB with BorderLayout
    JTable tableA
    JTable tableB
    The tables are 2 rows by 7 columns, and are two distinct instances of a class i wrote that extends JTable. They look and act the same, but there are two seperate references. They both use JComboBoxes to allow selectable data in each of the 14 cells.
    I then have:
    tablePanelA.add(tableA)
    tablePanelB.add(tableB)
    mainPanel.add(tablePanelA)
    mainPanel.add(tablePanelB)
    This sets up my main panel with the two tables on it looking how I want it to look. Heres the problem. Whenever I change the data in a cell in either table, the corresponding cell in the other table changes to that same data item also. For example, if i change cell 0,4 in table A to "None", then cell 0,4 in table B will also change to "None". You only see the change on a refresh of the panel, by changing windows to and from the panel, etc. Any ideas on why my tables would be changing each others data?

    Any ideas on why my
    tables would be changing each others data?It sounds like you're sharing a single TableModel instance between the two tables. When one table updates the model, it fires a TableModelEvent which notifies both JTable instances to update their views.

  • How to import DDL for multiple tables referencing each other?

    Hello people,
    I'm having a non-trivial problem. I need to copy a few tables from one machine to another, both 10g. Just DDL, data copying is not necessary. When I export the DDL to an SQL file using Oracle SQL Developer, the resulting file is refused at the import (again, SQL Developer). The problem is that every table references some other table(s), so every single "create table" command is refused, because the needed table is has not been created yet. What's the best solution to be applied here?
    Maybe I can draw a parallel to adding packages in Debian. When you have two packages, A and B, and they depend on each other, you cannot install them using "dpkg -i A && dpkg -i B" nor the other way around. Both calls to the dpkg will fail, due to the missing respective package. However, installing them in one command ("dpkg -i A B") is the right way. This is EXACTLY what I'd love to do with Oracle. Tell it to wait a bit, to make sure that ALL of the necessary tables are specified, and then create them virtually at once. Can it be achieved with transaction management?
    Thanks a lot for any help.

    Use exp/imp or expdb / impdp
    They will only enable constraints after all tables are imported.

  • Two iphones  receiving each others text massages

    I have two iphones synced to the same computer receiving each others text massages, how do I fix it?

    On each phone go to Settings > Messages > Send and Receive and select only the phone number of the phone in question. Each phone should have only its own number selected. F each phone has its own unique email address you can select that as well. But do not select any phone number or email address that resides on a different phone.

  • Cannot Align Two Objects On Each Other

    I have done a completely clean install of Creative Cloud CS6 on my mac on Mountain Lion. First time opening Illustrator, and I cannot center two vector objects on each other. Rather, when I click to center them (vertically or horizontally) it actually pushes them further apart! It also appears to be arbitrarily selecting another object on my art board when I select these two (there is no grouping overlap, it makes no sense). I've looked around before, and have 'align to selection' checked, and 'snap to grid/snap to point' unchecked in the 'view' dropdown. Going to try to trash my preferences, but this is literally the first time I've opened it, so I can't see how that would be an issue!
    I use this tool CONSTANTLY in what I do, so this is really troubling. Has anyone had a similar problem and fixed it? Thanks so much!!

    I held down Option+Command+Shift while opening Illustrator (as offered in another thread as a way to trash/reset preferences). I know it did this as I had changed the color scheme to light grey, and it's back to dark grey.
    Opened up original file. Now, I can center things horizontally alright, but vertically jumped the both of them way down the page.
    Created a new file. Could center horizontally, centering vertically did absolutely nothing—no jumping down the page, no doing what it should be doing...nada.

  • Classes using each other in packages

    I've almost understood package's mechanic. But when I try to use class which is defined in another file in a package I've got an error :/. I have CLASSPATH set to .;.
    Here is sample code:
    File Main.java
    package testpackage;
    public class Main {
           public static void main(String args[]) {
                    JLogin login = new JLogin();
                    login.setSize(250,100);
                    login.setVisible(true);
       }File JLogin.java starts with package testpackage; too and contains public class JLogin.
    When I dont use package (only default packages), everything is ok.
    But when I move Main.java to upper directory and write import testpackage.JLogin; instead of package word everything is ok.
    Thx in advance

    Which files are in which directories?
    What's your classpath?
    What command are you using to compile/run?
    What is the error you're getting?

  • Parallelly scrolling two list with each other.

    Hi All,
    I am new in windows phone 8 development. MY issue is i want to scroll two list simultaneously with other. Means if i scroll first list then other list should be scroll parallelly with first list ,so that we can display data of same index of both list parallelly.
    How can achieve this in windows phone 8.
    In Android and Iphone they are able to do this features. 
    Please help me.
    Thanks in advance.

    Thanks Vineet for your response.
    Can you please show me your xaml code where i have to put scrollviewer in listbox. I am unable to scroll second list with first list. My xaml code is below for first listbox.
    <ListBox Grid.Row="1" Background="#1D1C1A" Name="lstChannelList" VerticalAlignment="Top" ItemsSource="{Binding}"
    ScrollViewer.VerticalScrollBarVisibility="Visible" SelectionChanged="lstChannelList_SelectionChanged" LayoutUpdated="lstChannelList_LayoutUpdated" >
    <ListBox.ItemTemplate>
    <DataTemplate>
    <ScrollViewer VerticalAlignment="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" >
    <StackPanel Orientation="Horizontal">
    <Grid Margin="0,0,3,0" Grid.Row="0" Background="{Binding color}" >
    <Grid.RowDefinitions>
    <RowDefinition Height="60"/>
    <RowDefinition Height="5"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="50"/>
    <ColumnDefinition Width="10*"/>
    </Grid.ColumnDefinitions>
    <TextBlock VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Text="{Binding number}" Foreground="{Binding forcolor}" FontWeight="Bold"/>
    <TextBlock VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" Text="{Binding channel_name}" Foreground="White" HorizontalAlignment="Left"/>
    <StackPanel Grid.Row="1" Grid.ColumnSpan="2" Background="Gray" Width="800" Height="3"/>
    </Grid>
    </StackPanel>
    </ScrollViewer>
    </DataTemplate>
    </ListBox.ItemTemplate>
    <ListBox.ItemContainerStyle>
    <Style TargetType="ListBoxItem">
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>
    </ListBox.ItemContainerStyle>
    </ListBox>
    and second list xaml are below.second list data are static.
    <ListBox Grid.Row="1" Background="#1D1C1A" Name="lstChannel" VerticalAlignment="Top" ItemsSource="{Binding}"
    ScrollViewer.VerticalScrollBarVisibility="Visible" >
    <ListBox.ItemTemplate>
    <DataTemplate>
    <ScrollViewer VerticalAlignment="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Width="480">
    <StackPanel Orientation="Vertical">
    <Grid Margin="0,0,3,0" Grid.Row="0" Background="{Binding forcolorside}">
    <Grid.RowDefinitions>
    <RowDefinition Height="60"/>
    <RowDefinition Height="5"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="3"/>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="3"/>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="3"/>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="3"/>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="3"/>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="3"/>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="3"/>
    </Grid.ColumnDefinitions>
    <StackPanel Background="Gray" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" Width="3" />
    <Grid Grid.Row="0" Grid.Column="1" Background="{Binding forcolorside}">
    <TextBlock VerticalAlignment="Center" Text="Pluto pick's 2014" Foreground="White" TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
    </Grid>
    <StackPanel Background="Gray" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right" Width="3" />
    <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="3" Background="{Binding forcolorside}">
    <TextBlock VerticalAlignment="Center" Text="Pluto pick's 2014" Foreground="White" TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
    </StackPanel>
    <StackPanel Background="Gray" Grid.Row="0" Grid.Column="4" HorizontalAlignment="Right" Width="3" />
    <Grid Grid.Row="0" Grid.Column="5" Background="{Binding forcolorside}">
    <TextBlock VerticalAlignment="Center" Text="Pluto pick's 2014" Foreground="White" TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
    </Grid>
    <StackPanel Background="Gray" Grid.Row="0" Grid.Column="6" HorizontalAlignment="Right" Width="3" />
    <Grid Grid.Row="0" Grid.Column="7" Background="{Binding forcolorside}">
    <TextBlock VerticalAlignment="Center" Text="Pluto pick's 2014" Foreground="White" TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
    </Grid>
    <Grid Background="Gray" Grid.Row="0" Grid.Column="8" HorizontalAlignment="Right" Width="3" />
    <Grid Grid.Row="0" Grid.Column="9" Background="{Binding forcolorside}">
    <TextBlock VerticalAlignment="Center" Text="Pluto pick's 2014" Foreground="White" TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
    </Grid>
    <Grid Background="Gray" Grid.Row="0" Grid.Column="10" HorizontalAlignment="Right" Width="3" />
    <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="11" Background="{Binding forcolorside}">
    <TextBlock VerticalAlignment="Center" Text="Pluto pick's 2014" Foreground="White" TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>
    </StackPanel>
    <Grid Background="Gray" Grid.Row="0" Grid.Column="12" HorizontalAlignment="Right" Width="3" />
    <StackPanel Grid.Row="1" Grid.ColumnSpan="13" Background="Gray" Width="500" Height="3"/>
    </Grid>
    </StackPanel>
    </ScrollViewer>
    </DataTemplate>
    </ListBox.ItemTemplate>
    <ListBox.ItemContainerStyle>
    <Style TargetType="ListBoxItem">
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>
    </ListBox.ItemContainerStyle>
    </ListBox>
    Both list have six rows. and second list i am displaying above first list. So i want to parallelly rotate item of both list if any list scrolling. Please show me your XAML.
    I am unable to scroll second list if first list is scrolling above.
    Thanks once again vineet.

Maybe you are looking for

  • Custom Calculation Script - Multiplication IF

    Hey Adobe peeps, need help here. I'm not a programmer by any stretch of the imagination, but I am resourceful, BUT I have yet to find a concrete answer for this, nor can I get any of my test formula's to work. I have a fillable PDF that is used in a

  • I cannot open or create any files in photoshop

    Everything was working and then all of a sudden this morning my photoshop do not work as it should. When I click on open (any) file it looks like it would open as it lets you select the file but then when you say okay nothing happens, it doesnt think

  • Will iphone cases work with the touch

    when looking for a case, can you use an iphone case? or do you have to buy specific touch cases?

  • How to keep the date in session

    Hi all, I am involved in a struts project where i had the following requirement. I had a search page where there are some fileds including a date field. For the date field i had 5 options like =,<=,>= and between. The problem i am facing is when i se

  • How to buy discounted upgrade from CS5.5 to CS6

    I own CS5.5, and subscribe to CC as well. I'd like to upgrade my perpetual license to CS6 in case there are years when I don't want the CC subscription. I see in the FAQ that discounted upgrade is available, but I cannot find a link to upgrade pricin