GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes dot operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "dot operator" Watch "dot operator" New topic
Author

dot operator

amarkirt saroay
Ranch Hand

Joined: Mar 16, 2008
Posts: 167
If the dot(.) operator is used to access a bean property but the property does not exist ,then a runtime exception is thrown . Is this statement correct?


SCJP-75%
SCWCD-82%
Tripati Sahu
Greenhorn

Joined: Jul 11, 2009
Posts: 25
can you please provide an example???
amarkirt saroay
Ranch Hand

Joined: Mar 16, 2008
Posts: 167
For example:

If there is a bean named customer and it has only one property say name but it does not have a property say age.
So ,
Will this EL throw a runtime exception?: ${customer.age} or ${customer["age"]}
Mateus Lucio
Ranch Hand

Joined: Jul 27, 2006
Posts: 57
Yes, an EL Exception will be thrown!

Since it's a bean object ${customer.age} it's like customer.getAge() but that method does not exists.


Studying ...
 
GeeCON Prague 2014
 
subject: dot operator