Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ePractice Exam Question (UML)

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
For my next trick, I'll need the help of a tiny ad ...
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic