Problem with method and classes
hi guys, i'm new to the java language, so I met some difficulties undestanding a code line:
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.
Re: Problem with method and classes
Quote:
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)
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)...
Re: Problem with method and classes
Have you tried using static imports?