The Artima Developer Community
Sponsored Link

Java Answers Forum
Would someone be so kind as to view and verify....

2 replies on 1 page. Most recent reply: Jul 18, 2005 4:30 AM by Luke

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Luke

Posts: 5
Nickname: locoluke
Registered: Jun, 2005

Would someone be so kind as to view and verify.... Posted: Jul 17, 2005 4:24 PM
Reply to this message Reply
Advertisement
I have a couple problems here that I have answered. I am not 100% sure of my answer(s). Would you be so kind as to check them and provide suggestions if they are not correct. These 2 questions are regarding what methods super/sub class(es) can invoke (question1) and which objects invoke which methods (question2). Thanks in advance.

Question 1
==================================================
Super Class: Expression (Includes prefix, postfix, and infix expressions)
Public Method: characterAt
Protected Method: isOperator
Protected Method: isIdentifier
Private Method: somePrivateMethoda
Private Method: somePrivateMethodb

SubClass: InfixExpression (Derived from Expression. Represents infix expression)
Public Method: isLegal
Public Method: evaluate
Protected Method: someProtectedMethoda
Protected Method: someProtectedMethodb
Private Method: anotherPrivateMethoda
Private method: anotherPrivateMethodb
==================================================
What methods can the implementation of isIdentifier invoke?
CharacterAt
isOperator
somePrivateMethoda
somePrivateMethodb

What methods can the implementation of isLegal invoke?
characterAt
isOperator
isIdentifier
evaluate
someProtectedMethoda
someProtectedMethodb
anotherPrivateMethoda
anotherPrivateMethodb


Question 2
Assuming the classes described in the previous question and consider a main method that contains:

Expression algExp;
InfixExpression infixExp;

Soooo...
==================================================
Super Class: Expression (Includes prefix, postfix, and infix expressions)
Main Method: algExp
Public Method: characterAt
Protected Method: isOperator
Protected Method: isIdentifier
Private Method: somePrivateMethoda
Private Method: somePrivateMethodb

SubClass: InfixExpression (Derived from Expression. Represents infix expression)
Main Method: infixExp
Public Method: isLegal
Public Method: evaluate
Protected Method: someProtectedMethoda
Protected Method: someProtectedMethodb
Private Method: anotherPrivateMethoda
Private method: anotherPrivateMethodb
==================================================
Whic h of these objects can correctly invoke the method CharacterAt?
algExp and infixExp

Which of these objects can correctly invoke the method isOperator?
algExp and infixExp

Which of these objects can correctly invoke the method isLegal?
infixExp


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Would someone be so kind as to view and verify.... Posted: Jul 17, 2005 11:42 PM
Reply to this message Reply
That all sounds about right.

Luke

Posts: 5
Nickname: locoluke
Registered: Jun, 2005

Re: Would someone be so kind as to view and verify.... Posted: Jul 18, 2005 4:30 AM
Reply to this message Reply
Thank you. It's nice to know someone would take the few minutes necessary to review my post and respond. Thanks again.

Flat View: This topic has 2 replies on 1 page
Topic: Answer this question if you can Previous Topic   Next Topic Topic: maintenance of a web site

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use