Results 1 to 20 of 20

Thread: java

  1. #1
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Yes, you can.

  3. #3
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default code

    how pls send me the code?

  4. #4
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    7

    Default

    class A{
    static{
    System.out.println("Hi!!I am a static block...");
    }
    }

  5. #5
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default

    how many methods are there in java?

  6. #6
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default

    isthis program exicutes with out any error?

  7. #7
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    7

    Default

    You wont get any compilation error, but during execution it will print the message (which proves that a static block is executed even before the execution of main) and come out with an error msg some like main method not found.

  8. #8
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default

    what is static method()?

  9. #9
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    7

    Default

    The static keyword has a special significance i.e. its not related to any specific instance of the class. As far as static method is concerned it can be called without any reference of the class i.e. ClassName.staticmethodname() for e.g. Math.random(). Another point is a static method can only access other static data members of the class.

  10. #10
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default

    why another methods are not acessed by static method?

  11. #11
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default

    what is meant by Eclips??

  12. #12
    chrono25 is offline Member
    Join Date
    Feb 2009
    Posts
    10
    Rep Power
    0

    Default

    A static method can be accessed without creating an instance of the class. If you try to use a non-static method and variable defined in this class then the compiler will say that non-static variable or method cannot be referenced from a static context. Static methods can call only other static methods and static variables defined in the class.

  13. #13
    padma is offline Member
    Join Date
    Feb 2009
    Posts
    9
    Rep Power
    0

    Default

    Tell me somthing abt web Wizared?

  14. #14
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Google is your friend

    Something tells me that the questions are going to keep coming... padma... please try to do some research on your own.. the question about the printing and static methods has been answered.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  15. #15
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    7

    Default

    given that there is no continuity to the questions, i'm assuming this is someone's homework.

  16. #16
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default

    yeah... I sorta come to the same conclution... hence my comment...

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  17. #17
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    I suspected from the start that the OP was a homework-sniffing troll, hence my initial terse response.

  18. #18
    chrono25 is offline Member
    Join Date
    Feb 2009
    Posts
    10
    Rep Power
    0

    Default Lol

    i agree with you guys, but alas the knowledge harvest can be a good thing , i didn't know of the existence of that thing "web wizard" and now i know it's some kind of good html editor but then again there's ton of them... :P

  19. #19
    JVposter is offline Member
    Join Date
    Feb 2009
    Location
    Romania
    Posts
    11
    Rep Power
    0

    Default

    Quote Originally Posted by padma View Post
    with out main method you can print the message?
    System.out.println("message")

  20. #20
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by JVposter View Post
    System.out.println("message")
    You forgot to include the very important "the".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •