assertion problem

Discussion in 'Java' started by gk, Nov 5, 2006.

  1. gk

    gk Guest

    Say,The package favorite.fruits contains different classes for
    different fruits. Orange is one of the classes in this package. Assume
    that all the classes from this package are compiled with assertions
    enabled. The following will enable assertions at runtime for this
    package, but will disable it for the class Orange, using standard JDK
    1.4

    java -ea:favorite.fruits... -da:favorite.fruits.Orange <Main Class>



    i am confused with this syntax "<Main Class>"
    what does it mean by "<Main Class>" here ?
    does it have any special meaning ?
    do they want to mean Orange has the main method in it ? so Orange is
    the Main Class ?
    do i need to type "<Main Class>" as above ?
    gk, Nov 5, 2006
    #1
    1. Advertising

  2. <Main Class> means : The class with the main() method to execute which
    is the entry point of your Java program.
    Exactly like any other Java program execution:
    java <Main Class>
    It has nothing to do with assertions.
    Jean-Francois Briere, Nov 5, 2006
    #2
    1. Advertising

  3. gk

    Daniel Pitts Guest

    Jean-Francois Briere wrote:
    > <Main Class> means : The class with the main() method to execute which
    > is the entry point of your Java program.
    > Exactly like any other Java program execution:
    > java <Main Class>
    > It has nothing to do with assertions.


    They mean specifically to type in the fully qualified name of your
    class that has the public static void main(String[] args) entry point.

    For example "java net.virtualinfinity.myproject.MyMainClass"
    Jean-Francois is right, it has nothing to do with assertions.
    Daniel Pitts, Nov 5, 2006
    #3
  4. gk

    Chris Uppal Guest

    gk wrote:

    > i am confused with this syntax "<Main Class>"


    Quite often in computer programming, when someone writes (in documentation,
    comments, web-pages, Usenet...) something like

    do something with <XYZ>

    they mean that you should replace <XYZ> with something appropriate to the
    context. Usually the text in the <> will indicate roughly what sort of thing
    is expected. In your case the documentation is telling you to replace <Main
    Class> with the name of a class -- the one containg main().

    If you think about it, Java's use of <> in generics is a bit similar.

    -- chris
    Chris Uppal, Nov 6, 2006
    #4
  5. gk

    gk Guest

    Chris Uppal wrote:
    > gk wrote:
    >
    > > i am confused with this syntax "<Main Class>"

    >
    > Quite often in computer programming, when someone writes (in documentation,
    > comments, web-pages, Usenet...) something like
    >
    > do something with <XYZ>
    >
    > they mean that you should replace <XYZ> with something appropriate to the
    > context. Usually the text in the <> will indicate roughly what sort of thing
    > is expected. In your case the documentation is telling you to replace <Main
    > Class> with the name of a class -- the one containg main().
    >
    > If you think about it, Java's use of <> in generics is a bit similar.
    >
    > -- chris


    ok.

    can we infer from the above that Orange has the main method ?
    gk, Nov 6, 2006
    #5
  6. gk

    Chris Uppal Guest

    gk wrote:

    [me:]
    > > Quite often in computer programming, when someone writes (in
    > > documentation, comments, web-pages, Usenet...) something like
    > >
    > > do something with <XYZ>
    > >
    > > they mean that you should replace <XYZ> with something appropriate to
    > > the context. Usually the text in the <> will indicate roughly what
    > > sort of thing is expected. In your case the documentation is telling
    > > you to replace <Main Class> with the name of a class -- the one
    > > containg main().

    [...]
    > can we infer from the above that Orange has the main method ?


    No, not at all. Why should we be able to infer that ?

    -- chris
    Chris Uppal, Nov 6, 2006
    #6
  7. gk

    Daniel Pitts Guest

    gk wrote:
    > Chris Uppal wrote:
    > > gk wrote:
    > >
    > > > i am confused with this syntax "<Main Class>"

    > >
    > > Quite often in computer programming, when someone writes (in documentation,
    > > comments, web-pages, Usenet...) something like
    > >
    > > do something with <XYZ>
    > >
    > > they mean that you should replace <XYZ> with something appropriate to the
    > > context. Usually the text in the <> will indicate roughly what sort of thing
    > > is expected. In your case the documentation is telling you to replace <Main
    > > Class> with the name of a class -- the one containg main().
    > >
    > > If you think about it, Java's use of <> in generics is a bit similar.
    > >
    > > -- chris

    >
    > ok.
    >
    > can we infer from the above that Orange has the main method ?


    You can't infer the main method. You have to create it.
    Classes only define structure, you have to create an "entry point" into
    your program. The entry point (usually a main method) tells the
    computer what to do, such as create an object or execute a method call.
    Daniel Pitts, Nov 6, 2006
    #7
  8. gk

    gk Guest

    Chris Uppal wrote:
    > gk wrote:
    >
    > [me:]
    > > > Quite often in computer programming, when someone writes (in
    > > > documentation, comments, web-pages, Usenet...) something like
    > > >
    > > > do something with <XYZ>
    > > >
    > > > they mean that you should replace <XYZ> with something appropriate to
    > > > the context. Usually the text in the <> will indicate roughly what
    > > > sort of thing is expected. In your case the documentation is telling
    > > > you to replace <Main Class> with the name of a class -- the one
    > > > containg main().

    > [...]
    > > can we infer from the above that Orange has the main method ?

    >
    > No, not at all. Why should we be able to infer that ?
    >
    > -- chris



    ok...fine.....this is nice......thanks
    gk, Nov 7, 2006
    #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. Marek Ponca

    Enumerated Type in assertion ?

    Marek Ponca, Jan 10, 2005, in forum: VHDL
    Replies:
    2
    Views:
    3,211
    Jonathan Bromley
    Jan 10, 2005
  2. Swapnajit Mittra
    Replies:
    0
    Views:
    493
    Swapnajit Mittra
    Aug 23, 2005
  3. Alex
    Replies:
    5
    Views:
    907
  4. lonelyplanet999

    Problem programming with assertion

    lonelyplanet999, Oct 30, 2003, in forum: Java
    Replies:
    2
    Views:
    631
    lonelyplanet999
    Nov 1, 2003
  5. cibalo
    Replies:
    2
    Views:
    181
    Rainer Weikusat
    May 23, 2013
Loading...

Share This Page