Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7016899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:50:42+00:00 2026-05-27T22:50:42+00:00

Imagine that I have two classes (shown below). Now imagine that I am compiling

  • 0

Imagine that I have two classes (shown below). Now imagine that I am compiling them using javac.exe from the command line. They won’t compile because class A needs class B’s methods to exist and vice versa. Is there any trick to getting them to compile from the command line? (Eclipse can compile this no problems!)

I should add they are both currently in two separate .java files.

public class A {
    public void doAWork() { /* A work goes here. */}
    public void doBWork() { new B().doBWork(); }
}
public class B {
    public void doBWork() { /* B work goes here. */}
    public void doAWork() { new A().doAWork(); }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:50:43+00:00Added an answer on May 27, 2026 at 10:50 pm

    It looks like your issue is elsewhere.

    I can perfectly compile the code in Java 1.5, 1.6 and 1.7 with the following command:

    javac A.java B.java
    

    Even providing a single file name works perfectly, since B.java is in the same directory:

    javac A.java
    

    Are you sure the two files are placed in appropriate directories?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a set of about two dozen classes that inherit from a base
Imagine that we have two tables as follows: Trades ( TradeRef INT NOT NULL,
Let's imagine that we have two arrays: $array_1 = array( '0' => 'zero', '1'
Imagine I have two (three, four, whatever) tasks that have to run in parallel.
Imagine that we have two static libraries built with different implementations of std::vector .
I have two classes. One is called Employee and the other EmployeeDetails that has
imagine that I have two services with the same domain but different hostnames and
Imagine, we have two .net applications. Application A starts application B using System.Diagnostics.Process class.
Imagine that I have the following two methods: void AddEvenNumbers() { for(int i=0; i<10000000;
Imagine that you have Nokogiri nodes representing the <a> elements in the following two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.