This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Using super keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using super keyword" Watch "Using super keyword" New topic

Using super keyword

Roger Fed
Ranch Hand

Joined: Oct 17, 2010
Posts: 82

I've developed these two classes, they are related by inheritance
when the last line executed in main , i want the "toString()" in the subclass call the "toString()" in the super class
I've tried to put this line "super.toString()" inside the the method in the subclass but it give me syntax error
I'd be grateful if you help me
thanks in advance.
this is main

and this is the GeometricObject class

I Hear I Forget, I See I Remember, I Do I Understand.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

There shouldn't be any problem. Can you show exactly how and where you wrote it ?

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Using super keyword
Similar Threads
(new to java)variables might not have been initialized
I need help on an equals method
Whyis the error "Exception in thread "main" java.lang.NoSuchMethodError: main"?
class extension problem
Triangle Problem