Article View: borland.public.jbuilder.java.language
Article #8578Is "return super;" a valid statement
From: Ralph Quapp
Date: Fri, 16 Mar 2001 19:03
Date: Fri, 16 Mar 2001 19:03
51 lines
1867 bytes
1867 bytes
Hello,
I encountered a compile error in one of my classes when using the statement
"return super;" and compiling it with javac or jikes. JBuilder does not
complain. In my example doSomething() in class B contains this statement.
The error reported is:
Error in file ReturnType.java at line 31, column 37: '.' expected
I am wondering now whether the statement is valid or not? And of course why?
regards Ralph
public class ReturnType
{
public class A
{
public String a = "A";
public A doSomething()
{
return this;
}
}
public class B extends A
{
public String b = "B";
public A doSomething()
{
return super; <---- error
}
}
public ReturnType()
{
B b = new B();
A a = b.doSomething();
}
public static void main(String[] args)
{
ReturnType r = new ReturnType();
}
}
Technical Details
Message-ID:
<3ab26402$1_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!sienna.impulse.net!63.208.208.143.MISMATCH!feed2.onemain.com!feed1.onemain.com!dca1-hub1.news.digex.net!jfk3-feed1.news.digex.net!intermedia!news.stealth.net!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews!63.197.90.11Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a2b6df84216d25a2,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-16 14:14:49 PST From: "Ralph Quapp" <-> Newsgroups: borland.public.jbuilder.java.language Subject: Is "return super;" a valid statement Date: Fri, 16 Mar 2001 11:03:41 -0800 Lines: 53 Organization: Alcatel Carrier Internetworking Division X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 63.197.90.11 Message-ID: <3ab26402$1_1@dnews> X-Trace: 16 Mar 2001 11:05:38 -0800, 63.197.90.11 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!sienna.impulse.net!63.208.208.143.MISMATCH!feed2.onemain.com!feed1.onemain.com!dca1-hub1.news.digex.net!jfk3-feed1.news.digex.net!intermedia!news.stealth.net!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews!63.197.90.11