Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

calling a method from a method

JayVinJayVin Member Posts: 14
how would you code to call a method from another method? Thanks.

Comments

  • joebeewjoebeew Member Posts: 61
    : how would you code to call a method from another method? Thanks.
    :


    if you have two methods.
    One called printName();
    and one called printAddress()

    while you are in printName(){

    printAddress();


    }

    Aint nothing to it but to do it!
    Linux: Because rebooting is for adding new hardware!

  • chamsterchamster Member Posts: 662
    : how would you code to call a method from another method? Thanks.

    1) If both methods are in the same class:
    [blue]doCallMethod ();[/blue]
    2) If the second method is static and in another class:
    [blue]AnOtherClass.doCallMethod ();[/blue]
    3) If the second method is instant (?):
    [blue]createdObject.doCallMethod ();[/blue]



    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    chamster@home.se
    http://konrads.webbsida.com

  • chamsterchamster Member Posts: 662
    By the way, it sounds like you're not just asking pushed purely by curiosity but rather because you have tried to do something and it didn't work the way you expaected it to (we call that "programming" :-)).

    If so, what did you tried to do and what did you actually do?



    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    chamster@home.se
    http://konrads.webbsida.com

  • JayVinJayVin Member Posts: 14
    Actually, it is by curiosity. I have read conflicting ways to call methods from methods, or maybe I'm just getting the programming languages confused. Your reply is excellent. And thank you for the concern.
  • chamsterchamster Member Posts: 662
    : Actually, it is by curiosity.

    Really? That's a new one. Well, the curious will rule the Earth eventually so...

    : I have read conflicting ways to call methods from methods, or maybe I'm just getting the programming languages confused. Your reply is excellent. And thank you for the concern.

    Thank you.



    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    chamster@home.se
    http://konrads.webbsida.com

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    __ | http://forcoder.org | free ebooks and video tutorials about | Swift, JavaScript, Delphi, C++, Go, Ruby, Visual Basic, Assembly, Java, R, Visual Basic .NET, Objective-C, Python, PL/SQL, Perl, C, C#, Scratch, MATLAB, PHP Clojure, Logo, Rust, Fortran, LabVIEW, Alice, Lisp, Scala, F#, Bash, Apex, ABAP, Erlang, Scheme, Dart, FoxPro, Lua, Hack, Crystal, D, COBOL, ML, VBScript, Ada, Kotlin, Awk, Prolog, SAS, Julia, Transact-SQL | _________

Sign In or Register to comment.