Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > a static equivalent of 'this'?

Reply
Thread Tools

a static equivalent of 'this'?

 
 
Adam Gray
Guest
Posts: n/a
 
      05-03-2008
Is there any way of doing the following:

public class MyClass
{
private int a;
private static int b;

public void setA(int a)
{
this.a = a;
}

public static void setB(int b)
{
// is there any way to do the code in here without having
// to use a different name for the parameter?
}
}
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      05-03-2008
Adam Gray wrote:
> Is there any way of doing the following:
>
> public class MyClass
> {
> private int a;
> private static int b;
>
> public void setA(int a)
> {
> this.a = a;
> }
>
> public static void setB(int b)
> {
> // is there any way to do the code in here without having
> // to use a different name for the parameter?


MyClass.b = b;

> }
> }


--

Knute Johnson
email s/nospam/linux/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
 
 
 
Adam Gray
Guest
Posts: n/a
 
      05-03-2008
Knute Johnson wrote:
> Adam Gray wrote:
>> Is there any way of doing the following:
>>
>> public class MyClass
>> {
>> private int a;
>> private static int b;
>>
>> public void setA(int a)
>> {
>> this.a = a;
>> }
>>
>> public static void setB(int b)
>> {
>> // is there any way to do the code in here without having
>> // to use a different name for the parameter?

>
> MyClass.b = b;
>
>> }
>> }

>


Simple really isn't it!!
Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what are Python equivalent to MATLAB persistent or C++ static? dmitrey Python 3 03-15-2007 10:29 PM
MapPath equivalent from static method Martin Eyles ASP .Net 4 04-04-2006 11:15 AM
equivalent of command "set cam static" ? vincent Cisco 2 01-26-2006 03:03 PM
PIX public/24 ip static mapping means 256 times interfaces static maps? Nieuws Xs4all Cisco 0 05-26-2005 11:07 AM
C's static equivalent KONTRA Gergely Ruby 5 08-07-2003 08:14 PM



Advertisments