Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Design class structure



Hi,
I have less experience in java designing. In one of the interviews I have been asked a question which is like ,Design/provide a java solution for the expression '(a+b)*(a-b)-c' ?

I went explaining that we could create classes like Operators,Operands and Expression and saying that the class Expression would be having Operators and Operands and child expression.

Any suggestion how to visualize the real time problem in terms of java.For example for the above question whether to make the class abstract/or have an interface and so on?