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

  • SEARCH
  • Home
  • 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 7177097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:38:28+00:00 2026-05-28T16:38:28+00:00

I have two questions – I’m a beginner in Java but have a huge

  • 0

I have two questions – I’m a beginner in Java but have a huge java project 🙁

  1. If I implement a class (which is an interface that has two void methods) and I try to write another method in my class, it compiles but at run time the method is skipped? What could I be doing wrong?

  2. How do I run a class from another class that is not the main. So basically the main runs a class which then calls another class…

I know these questions are pretty limited in terms of content but the program is really complexed at its just impossible to explain everything 🙁

Any help would be greatly Appreciated 🙂 Thanks!!

— updated – as requested

 class FriendLists implements Results {
     public void processCommunication (Communication d)  {...}

     public void postProcess() {...}

     //the above two run perfectly

     //I don't know what to do next. 
     //I'm trying to create a link to my other class, to use the values values 
     //but when compiled and running it skips this method (and all other methods except the above two

     public void processCommunication(AggregatedDirect f) {
     //does something from the class I'm trying to run
      man = f.getNumTargets(); //getNumTargets is a value in the AggregatedDirect Class
     }

,

interface Results {
void processCommunication (Communication c) throws SAXException;
    void postProcess();

}

,

  public  class AggregatedDirect extends Communication {
ArrayList<Integer> targets;


public AggregatedDirect(Direct d) {
    super();
    targets = new ArrayList<Integer>();
    this.type = d.getType();
    this.invocSerial = d.getInvocSerial();
    this.serial = d.getSerial();
    this.usage = d.getUsage();
    this.messageType = d.getMessageType();
    this.characterID = d.getCharacterID();
    this.characterStatus = d.getCharacterStatus();
    this.locationID = d.getLocationID();
    targets.add(d.getTargetCharacterID());
    this.targetCharacterID = -1;
    this.targetCharacterStatus = -1;
    this.targetCharacterLocationID = -1;
    this.message = d.getMessage();
    this.time = d.getTime();
    this.annotation = d.getAnnotation();
}

public void addTarget(int targetCharacterID) {
    targets.add(targetCharacterID);
}

public void addTarget(Direct d){
    addTarget(d.getTargetCharacterID());
}

public int getNumTargets() {
    if (targets == null)
        return -1;
    else
        return targets.size();
}
public ArrayList<Integer> getTargets() {


     return targets;
    }
}
  • Describe class Communication here.
  • Abstract superclass of all the communication
  • subclasses.
  • in effect – processes an XML file and separates it

    • Direct extends communications // it basically one of the String Values in the XML file
  • 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-28T16:38:29+00:00Added an answer on May 28, 2026 at 4:38 pm

    If you add another method to your class, but that method is not defined in your interface, and you’re using the Interface as the type when instantiating the object, then the Java runtime will not be aware that method exists.

    For instance:

    Class MyClass implements List {
    
        public void method1() {
            // do stuff
        }
    
        public void method2() {
            // do other stuff
        }
    
        public void method3() {  // not defined in Interface
            // do yet other stuff
        }
    
    }
    
    
    Interface List {
    
        void method1();
    
        void method2();
    
    }
    

    Now, if a service class in your code returns an object of type “List”, then your calling class won’t know the subtype:

     List list = getMyList();
    
     list.method3();  // doesn't know what this is because it's type List not type MyClass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions but somehow related: How to implement flip 3d without Aero
I have two questions regarding interfaces in Java. 1) If a class happens to
I have two questions: 1) How can I make an array which points to
I have two questions: (1) I learned somewhere that -O3 is not recommended with
I have two questions about java.awt.Shape . Suppose I have two Shape s, shape1
I have two questions 1) my interface i have interface called IRegister and within
I actually have two questions regarding the same problem but I think it is
I actually have two questions regarding exception/error handling in the iPhone app that I
I have two questions, and should mention I am an Java programmer going into
I have two questions. My first one is, that how can i put something

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.