Can a Java program be both an applet and stand alone?

Discussion in 'Java' started by janzon@gmail.com, Feb 23, 2007.

  1. Guest

    Howdy!

    I made a Java test at a job interview today. One of the questions was,
    "Can a Java program be both an applet and a stand alone program?". I
    had now idea, and I'm curious what the answer might be, and what the
    question is supposed to mean more exactly...

    / Daniel
     
    , Feb 23, 2007
    #1
    1. Advertising

  2. On Feb 24, 8:42 am, wrote:
    ...
    > I made a Java test at a job interview today. One of the questions was,
    > "Can a Java program be both an applet and a stand alone program?". I
    > had now idea, and I'm curious what the answer might be,


    Yes.

    >..and what the
    > question is supposed to mean more exactly...


    Why didn't you ask the interviewers?

    Andrew T.
     
    Andrew Thompson, Feb 23, 2007
    #2
    1. Advertising

  3. "Andrew Thompson" <> wrote in message
    news:...
    > On Feb 24, 8:42 am, wrote:
    > ..
    >> I made a Java test at a job interview today. One of the questions was,
    >> "Can a Java program be both an applet and a stand alone program?". I
    >> had now idea, and I'm curious what the answer might be,

    >
    > Yes.


    And a JUnit test case, and a web service, and an ANT task, and a floor wax,
    ....

    The point, I think, is that all of these require writing "entry-point"
    methods that the environment running the program requires, and that these
    methods will happily be ignored by other environments.
     
    Mike Schilling, Feb 23, 2007
    #3
  4. Daniel Dyer Guest

    On Fri, 23 Feb 2007 21:54:46 -0000, Andrew Thompson
    <> wrote:

    > On Feb 24, 8:42 am, wrote:
    > ..
    >> I made a Java test at a job interview today. One of the questions was,
    >> "Can a Java program be both an applet and a stand alone program?". I
    >> had now idea, and I'm curious what the answer might be,

    >
    > Yes.
    >
    >> ..and what the
    >> question is supposed to mean more exactly...

    >
    > Why didn't you ask the interviewers?


    It's a rubbish interview question though. Assuming he got it right, how
    do they know whether he knew it or he guessed? It would have been better
    to have asked him to write a class that was both an application and an
    applet.

    Dan.

    --
    Daniel Dyer
    https://watchmaker.dev.java.net - Evolutionary Algorithm Framework for Java
     
    Daniel Dyer, Feb 23, 2007
    #4
  5. Mark Rafn Guest

    <> wrote:
    >I made a Java test at a job interview today. One of the questions was,
    >"Can a Java program be both an applet and a stand alone program?". I
    >had now idea, and I'm curious what the answer might be, and what the
    >question is supposed to mean more exactly...


    You're supposed to ask the interviewer what he means by a "Java program".

    If he means an actual running instance of a VM, I can't think of a way to
    get it to run both an applet and a main standalone entry point easily, but
    it's probably possible with a lot of contortions.

    If he means an entire codebase, the answer is a clear yes.
    Just have different entry points for the Applet use and the standalone use
    (and possibly multiple different classes for each - there's no reason not to
    have 12 classes that are standalone starting points and another 4 that are
    Applets).

    If he means a single class, the answer is still yes. There's nothing to stop
    a class that extends Applet to have a static void main(String[]) method.
    --
    Mark Rafn <http://www.dagon.net/>
     
    Mark Rafn, Feb 23, 2007
    #5
  6. Guest

    On 23 Feb, 22:54, "Andrew Thompson" <> wrote:
    > On Feb 24, 8:42 am, wrote:
    > ..
    >
    > > I made a Java test at a job interview today. One of the questions was,
    > > "Can a Java program be both an applet and a stand alone program?". I
    > > had now idea, and I'm curious what the answer might be,

    >
    > Yes.


    Do you got a reference to a document containing an example or a
    description of how it works?

    > >..and what the
    > > question is supposed to mean more exactly...

    >
    > Why didn't you ask the interviewers?


    Since the persons around were from management, not from the tech crew
    (who were not in office; the interview was at eight O'Clock in the
    morning).
     
    , Feb 23, 2007
    #6
  7. Oliver Wong Guest

    "Daniel Dyer" <"You don't need it"> wrote in message
    news:eek:...
    > On Fri, 23 Feb 2007 21:54:46 -0000, Andrew Thompson
    > <> wrote:
    >
    >> On Feb 24, 8:42 am, wrote:
    >> ..
    >>> I made a Java test at a job interview today. One of the questions was,
    >>> "Can a Java program be both an applet and a stand alone program?". I
    >>> had now idea, and I'm curious what the answer might be,

    >>
    >> Yes.
    >>
    >>> ..and what the
    >>> question is supposed to mean more exactly...

    >>
    >> Why didn't you ask the interviewers?

    >
    > It's a rubbish interview question though. Assuming he got it right, how
    > do they know whether he knew it or he guessed? It would have been
    > better to have asked him to write a class that was both an application
    > and an applet.


    Maybe that would have been the follow-up question had the interviewee
    answered "yes".

    - Oliver
     
    Oliver Wong, Feb 23, 2007
    #7
  8. On Feb 24, 9:46 am, wrote:
    > On 23 Feb, 22:54, "Andrew Thompson" <> wrote:
    > > On Feb 24, 8:42 am, wrote:
    > > ..
    > > > "Can a Java program be both an applet and a stand alone program?".

    ...
    > > Yes.

    >
    > Do you got a reference to a document containing an example or a
    > description of how it works?


    Example code of one..
    <http://groups.google.com/groups?selm=s3_Ch.
    50778$>
    Demo of another..
    <http://www.physci.org/jws/#jtest>

    Andrew T.
     
    Andrew Thompson, Feb 23, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GS
    Replies:
    1
    Views:
    715
    Nanda Lella[MSFT]
    Apr 13, 2006
  2. Guest
    Replies:
    1
    Views:
    478
    Guest
    Sep 12, 2003
  3. freeposte
    Replies:
    7
    Views:
    4,702
    Roedy Green
    Feb 10, 2006
  4. Praveen Mohanan
    Replies:
    3
    Views:
    5,116
    Tony Morris
    May 4, 2006
  5. Plotinus
    Replies:
    2
    Views:
    298
    Tad McClellan
    Dec 17, 2004
Loading...

Share This Page