Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #18239
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail |
|---|---|
| From | "yanamandra" <yanamandra@1:261/38.remove-fzq-this> |
| Subject | Need help with a program. |
| Message-ID | <50327C3C.57163.calajapr@time.synchro.net> (permalink) |
| X-Comment-To | All |
| Newsgroups | comp.lang.java.programmer |
| X-FTN-AREA | COMP.LANG.JAVA.PROGRAMMER |
| X-FTN-MSGID | 1:261/38 5ab5fcd9 |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] |
| Lines | 65 |
| Date | Mon, 20 Aug 2012 18:58:38 GMT |
| NNTP-Posting-Host | 69.21.70.65 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1345489118 69.21.70.65 (Mon, 20 Aug 2012 13:58:38 CDT) |
| NNTP-Posting-Date | Mon, 20 Aug 2012 13:58:38 CDT |
| Organization | tds.net |
| X-Received-Bytes | 1967 |
| Xref | csiph.com comp.lang.java.programmer:18239 |
Show key headers only | View raw
From: yanamandra <venu.yanamandra@gmail.com>
Why does the function printall() print the base class (c1) member values? If
that is reasonable, what is the method to print the extended class (cls) values
using the base class function printall().
=========
class c1
{
public static int i1;
private static int i2;
protected static int i3;
c1()
{
i1 = 10;
i2 = 20;
i3 = 30;
}
protected void printall()
{
System.out.println("From C1: i1 is: {" + i1 + "}, i2 is: {" + i2 +
"} and i3 is: {" + i3 + "}");
}
}
class cls extends c1
{
public static int i1;
private static int i2;
protected static int i3;
cls()
{
i1 = 40;
i2 = 50;
i3 = 60;
}
/*
*/
public static void main(String[] args)
{
cls cls1 = new cls();
cls1.printall();
c1 cls2 = cls1;
cls2.printall();
System.out.println("From CLS: i1 is: {" + i1 + "}, i2 is: {" + i2
+ "} and i3 is: {" + i3 + "}");
}
}
=========
--- BBBS/Li6 v4.10 Dada-1
* Origin: Prism bbs (1:261/38)
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Need help with a program. "yanamandra" <yanamandra@1:261/38.remove-fzq-this> - 2012-08-20 18:58 +0000
csiph-web