Results 1 to 4 of 4
  1. #1
    picasso88 is offline Member
    Join Date
    Jan 2012
    Posts
    2
    Rep Power
    0

    Default Problem with method and classes

    hi guys, i'm new to the java language, so I met some difficulties undestanding a code line:

    Java Code:
    List<Diary> list = query<Diary>(diaries).execute();
    I need to generate classes and methods that allow to use that line of code. So i've 2 questions:

    1. There's a way to use query<Diary>(diaries) as a method that returns an object (istance of a class with the method execute) without the syntax object.method() or class.method()?

    Moreover, i could define this method within a class where I've to use that line of code, but i would use that line of code also in other classes.

    2. There's an alternative way to call that method without the standard syntax?

    Thanks a lot in advance.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: Problem with method and classes

    without the syntax object.method() or class.method()?
    Make it a local method.
    You could call a local method (however it does have the implied this. object reference)

  3. #3
    picasso88 is offline Member
    Join Date
    Jan 2012
    Posts
    2
    Rep Power
    0

    Default Re: Problem with method and classes

    But if I wish use that method also in other classes? without standard syntax: instanceName.methodName(); or className.methodName(); (the 2nd in case of static method)...

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

Similar Threads

  1. Classes Problem
    By FreeQy in forum New To Java
    Replies: 5
    Last Post: 11-05-2011, 03:37 PM
  2. Problem with classes
    By liakos in forum NetBeans
    Replies: 14
    Last Post: 03-10-2011, 07:34 PM
  3. inner classes problem
    By smallmos1 in forum New To Java
    Replies: 7
    Last Post: 11-18-2010, 03:07 PM
  4. Thread problem, calling method in run method
    By majk in forum Threads and Synchronization
    Replies: 4
    Last Post: 09-27-2010, 11:40 AM
  5. Replies: 2
    Last Post: 07-04-2008, 12:33 PM

Posting Permissions

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