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 7817891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:23:31+00:00 2026-06-02T06:23:31+00:00

I am writing a code that will simulate the Kerberos protocol in Java. I

  • 0

I am writing a code that will simulate the Kerberos protocol in Java. I have a server class and a client class. But some content is static and other content is not, plus sockets, I’m mixed up to say the least. The details of the protocol I believe are arbitrary in this question.

I have a Server class, which calls a ServerThread class:

public class Server{

    public void someMethod(){ /* some code */ }

    public static void main(String args[]){ 
        ServerSocket serverSocket = new ServerSocket(port);
        new ServerThread(serverSocket.accept()).start();
    }
}

public class ServerThread extends Thread{
    /* constructor (takes serverSocket from Server) */

    this.parent.someMethod();
    /* That would call someMethod() from the parent class Server instance
     * that instantiated this.
     */
    }

The part of the Server class that instantiates the ServerThread was given to me, I have to use it as is. The someMethod() method I wrote myself, that’s the one I want to use from ServerThread. Is there a way to do this call the line of code that says this.parent.someMethod();? If I can, is there a way to access both classes from a single controller class, or does the static content vs. non-static content ruin that idea?

  • 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-06-02T06:23:32+00:00Added an answer on June 2, 2026 at 6:23 am

    Can you pass a reference to an instance of the Server to the ServerThread (via getter/setters or modifing the constructor)? If so, pass the reference and then you can call server.someMethod(), assuming server is the variable name.

    If not, would your someMethod() make sense as a static method? If it is safe to make it a static method, you can do Server.someMethod().

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

Sidebar

Related Questions

I'm writing some C++ code that will have to send data over TCP/IP. I
I am writing code that will migrate some data from one database to another,
I'm writing some code that will serialize a C# object to JSON, send it
I am writing some new code that will throw a custom exception - I
i am writing some code in vb.net that will be generating a pdf file.
I'm writing some code (just for fun so far) in Python that will store
I am writing a macro for Visual studio that will generate some code. I
I have a dev, that will get around our code coverage by writing tests
I need help with writing some code that will create a random number from
I've been writing some code that extracts the main textual content from web pages.

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.