How is this a method?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kid Programmer
    New Member
    • Mar 2008
    • 176

    How is this a method?

    Hello guys. I have a question. How is:
    Code:
    System.out.println("Hello, world!");
    a method? I haven't typed anything like:
    Code:
    void System.out.println() {
    blahblahblah
    }
    and I never typed:
    Code:
    System.out.println();
    So how is this a method call? Also do you think that Java C++ etc should be called Object Oriented Programming Languages(oop) or Class Oriented Programming Languages(cop). Thanks :-)
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Originally posted by Kid Programmer
    Hello guys. I have a question. How is:
    Code:
    System.out.println("Hello, world!");
    a method? I haven't typed anything like:
    Code:
    void System.out.println() {
    blahblahblah
    }
    and I never typed:
    Code:
    System.out.println();
    So how is this a method call?
    println is a method of the "out" object that is a member of the "System" object. It is already defined, you don't have to define it yourself.

    Originally posted by Kid Programmer
    Also do you think that Java C++ etc should be called Object Oriented Programming Languages(oop) or Class Oriented Programming Languages(cop). Thanks :-)
    Is this a homework question?

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Originally posted by Kid Programmer
      ...
      Also do you think that Java C++ etc should be called Object Oriented Programming Languages(oop) or Class Oriented Programming Languages(cop). Thanks :-)
      What exactly would be the difference between Object Orientated and Class Orientated languages?

      Classes are blueprints used to create objects, so in that sense, they would be one and the same.

      Comment

      • lotus18
        Contributor
        • Nov 2007
        • 865

        #4
        Originally posted by insertAlias
        println is a method of the "out" object that is a member of the "System" object. It is already defined, you don't have to define it yourself.
        As what I've learned println is a method of the out object and out object is from the System class.

        Rey Sean

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Originally posted by lotus18
          As what I've learned println is a method of the out object and out object is from the System class.

          Rey Sean
          Right, right. out is a static instance of a PrintStream class, and it belongs to the System class. I can't remember if System is instantiated or not.

          Anyway, this is all just semantics.

          Edit:
          And apparently asked and answered in another forum:

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by insertAlias
            Right, right. out is a static instance of a PrintStream class, and it belongs to the System class. I can't remember if System is instantiated or not.

            Anyway, this is all just semantics.

            Edit:
            And apparently asked and answered in another forum:
            Yep, It's a Java question in case anyone hasn't noticed.

            Comment

            • Curtis Rutland
              Recognized Expert Specialist
              • Apr 2008
              • 3264

              #7
              Originally posted by r035198x
              Yep, It's a Java question in case anyone hasn't noticed.
              Yeah, I thought so, but then I remembered J#. So I guess technically its ok for a .NET forum, right?

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by insertAlias
                Yeah, I thought so, but then I remembered J#. So I guess technically its ok for a .NET forum, right?
                That's the reason why the thread has not been moved to the Java forum.

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #9
                  However it should be MERGED with the java thread.
                  Since identical psots really do not belong in TWO places.

                  Comment

                  Working...