all groups > vj# > march 2004 >
You're in the

vj#

group:

Equivalent of " out" Keyword


Equivalent of " out" Keyword swati
3/18/2004 1:46:13 AM
vj#:

Hello

What is the equivalent for "out" keyword present in C# in J#
Should we use/**@ref*/ in place of out ?

Re: Equivalent of " out" Keyword Lars-Inge Tønnessen
3/18/2004 1:24:54 PM
Java does not have C * pointers etc. I have never seen examples on how to
use /** @ref */. Is this new in J#1.2 ?

( The /** @ref */ does not work on my computer. Maybe Amit or anyone else
could please give us an J# example? )


You can do that by a holder object or an array in Java. Here are both
examples.

// Example One
public class holder
{
public int number;

public holder()
{
}
}


/**
* Summary description for Class1.
*/
public class Class1
{

// Example One
public void runme( holder Obj )
{
Obj.number = 25;
}



// Example Two
public void runtwo( int[] numb )
{
numb[0] = 34;
}



public Class1()
{
// Example One
holder one = new holder();
one.number = 1;
System.Console.WriteLine("Out : "+one.number );
this.runme( one );
System.Console.WriteLine("Out : "+one.number );



// Example Two
int[] noTwo = new int[2];
noTwo[0] = 1;
System.Console.WriteLine("Out : "+noTwo[0] );
this.runtwo( noTwo );
System.Console.WriteLine("Out : "+noTwo[0] );
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}



Lars-Inge Tønnessen
www.larsinge.com

AddThis Social Bookmark Button