Re: Array of Objects
From: Sudsy (bitbucket44_at_hotmail.com)
Date: 02/16/04
- Next message: Sudsy: "Re: Skinning Again: Which is best, jXUL, XUL, or what?"
- Previous message: Lee Weiner: "Re: Array of Objects"
- In reply to: Sitaram: "Array of Objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 15 Feb 2004 19:37:24 -0500
Sitaram wrote:
<snip>
> class t1
> {
> public static int x;
public int x;
> public static String y;
public String y;
>
> public static void pushin(int p)
public void pushin(int p)
> {
> x=p;
> }
> public static void pusht(String p)
public void pusht(String p)
> {
> y=p;
> }
> public void disp()
> {
> System.out.println(x);
> System.out.println(y);
> }
> };
<snip>
By making the methods and variables static you're saying that
they have class scope rather than instance scope. Make the
changes listed above and the results will be what you expect.
- Next message: Sudsy: "Re: Skinning Again: Which is best, jXUL, XUL, or what?"
- Previous message: Lee Weiner: "Re: Array of Objects"
- In reply to: Sitaram: "Array of Objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|