• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ePractice Exam Question (UML)

 
John Kaye
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I recently went through the first of the ePractice exams for SCJA certification and came across a UML question that I answered incorrectly. I am no UML guru, so I was hoping someone would be able to help clarify my thoughts on the question.

The question was basically "How to implement Interface X, Interface Y, Class Z in Java" where Z implemented interfaces X and Y. The actual code for the answers is unimportant - suffice it to say that there were a number incorrect fragments, a correct Java fragment, and a statement that the UML diagram was illegal.

I picked the correct Java code out immediately, but then looked a little deeper, and noticed that the interface operations of Interface X and Interface Y were not italicised. My UML reference in preparation ("UML for the Java Associate PDF" from HF) suggests that abstract operations are italicised within UML diagrams.

As interfaces cannot provide implementation of methods (and as I have seen several carefully worded questions to catch out the participant within the Sun certification exams) I then deduced that as interface X and interface Y appeared to provide concrete implementation of their methods, the diagram was illegal.

This was marked as incorrect. However, the explanation I received did not mention the above observations, so I was hoping someone would be able to explain the declaration of abstract methods with interfaces in UML in relation to the question described above, as I am now a little confused!

I can provide a question reference if necessary - although I am quite sure I cannot post the actual question here!

Many thanks in advance ...
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how strict the use of italics in UML is, but a Java interface cannot provide implementation for any of its methods. Interface methods are implicitly public and abstract.
 
John Kaye
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marc.

This was one of the questions on the official Sun ePractice exams, presumably written by the same people as the real exams, so I wouldn't mind finding out more.

I may email their training department to find out what they say and will post the response here!
 
Andy Verkeyn
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


As you correctly state, an interface cannot contain any concrete method, all operations mentioned in an interface are inherently abstract.
Hence, as far as I know, the UML does not require that operations inside an interface are written in italics.
Italics is only required if you add an abstract method to a class.

The same is true for a utility class in UML. A utility class is a class that contains only class-scope (static) attributes and methods, e.g. the Math class in java. In UML, a static attribute or method is denoted by underlining it (instead of using italics for abstract ones). Also, a class marked as a utility class does not require underlining each attribute and method, because attributes and methods are by default static in a utility class.

Kind regards,
Andy
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't worry. Methods won't be italicized on the SCJA exam.

Class names will though, so look out!

-Cameron
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic