permaculture playing cards*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL function" Watch "EL function" New topic
Author

EL function

Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
Please consider the qoestion from HFSJ 1 edition mock.

Given an existing class:


Which are true about EL functions? (Choose all that apply.)

A. The MyFunctions class may NOT be used by EL because it has NOT been declared final.
B. The funct method may be used by EL because it has been declared static.
C. The funct method may NOT be use by EL because the calling arguments and return value must be object references.
D. The modX method may be used by EL because it is an instance method.
E. The MyFunctions class may be used by EL even though it has a public constructor.

correct options are in bold. I wonder if E would be correct one. Because to use as a EL function , block should be declared as public and static.
i think i am badly confused.


Thanks <br />Poonam Agarwal SCWCD 86%
Poonam Agarwal
Ranch Hand

Joined: May 12, 2008
Posts: 323
Is this mean that we can use a public class with public no-org contructor as a <function-class> ??
Rakesh Lakshminarayan
Greenhorn

Joined: Oct 09, 2008
Posts: 1
Hi,


The option B is correct because we can use the public static function to call from jsp using EL

The option E is correct because , even though the class has a no-arg public constructor , we are going to call only the static method within it . We are not going to create any instance of the class. So it is legal to use the so said class.

Ranchers , please correct me if I am wrong.

Rakesh


SCJP 1.5 , SCWCD5 in progress
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Because to use as a EL function , block should be declared as public and static.


Only the methods (which will be used as EL functions) should be public static.

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Milton Ochoa
Ranch Hand

Joined: Oct 23, 2007
Posts: 336

Hi all, I have another question.

If this class have a construct with argumts, will be a problem? I think that no. because, like said Rakesh. we are not instancing the class, only using statics methods!

correct me if I am wrong.

Very thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL function
 
Similar Threads
Inhertiting static member variable !
stars
What's your answer for this SCWCD mock exam question?
HFSJ mock question doubt
HFSJ EL-Functions mock question doubt