Results 1 to 3 of 3

Thread: Function Call Question

  1. #1

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    Baltimore
    Posts
    61

    Talking Function Call Question

    Can someone tell me how I would I call a Function in Java?
    Striver2000

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    For a non-static method you would need a handle to an object. For a static method you can just make the call via the class name.

  3. #3
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Code:
    public class X{
        public static void main(String[] args){
      
        String s = String.valueOf(525); static call
        System.out.println(s);
        String s2 = s.substring(0,2); // non-static call 
        System.out.println(s2);
     }
    }

Posting Permissions

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



Click Here to Expand Forum to Full Width