473,395 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to change variable value passed by argument?

In C++, we can do it like this:

void Square(int& value)
{
value *= value;
}

How can I do it in Java?

I try the following method, but it does not work.

void square(Integer value)
{
value = value * value;
}

Feb 6 '07 #1
6 1930
Allen wrote:
In C++, we can do it like this:

void Square(int& value)
{
value *= value;
}

How can I do it in Java?

I try the following method, but it does not work.

void square(Integer value)
{
value = value * value;
}
Why would you ask this in a C++ group? comp.lang.java
Feb 6 '07 #2
On 2月6日, 上午9时18分, Mark P <use...@fall2005REMOVE.fastmailCAPS.fm>
wrote:
Allen wrote:
In C++, we can do it like this:
void Square(int& value)
{
value *= value;
}
How can I do it in Java?
I try the following method, but it does not work.
void square(Integer value)
{
value = value * value;
}

Why would you ask this in a C++ group? comp.lang.java
It is a java question. Why ask it in C++ group?

Feb 6 '07 #3
Allen wrote:
On 2月6日, 上午9时18分, Mark P <use...@fall2005REMOVE.fastmailCAPS.fm>
wrote:
>Allen wrote:
>>In C++, we can do it like this:
void Square(int& value)
{
value *= value;
}
How can I do it in Java?
I try the following method, but it does not work.
void square(Integer value)
{
value = value * value;
}
Why would you ask this in a C++ group? comp.lang.java

It is a java question. Why ask it in C++ group?
Uh, yeah, exactly. Did you not read what I just wrote?
Feb 6 '07 #4
Allen wrote:
On 2鏈6鏃, 涓婂崍9鏃18鍒, Mark P <use...@fall2005REMOVE.fastmailCAPS.fm>
wrote:
>Allen wrote:
>>In C++, we can do it like this:
void Square(int& value)
{
value *= value;
}
How can I do it in Java?
I try the following method, but it does not work.
void square(Integer value)
{
value = value * value;
}
Why would you ask this in a C++ group? comp.lang.java

It is a java question. Why ask it in C++ group?
That was precisely Mark P's point. This is comp.lang.c++ (i.e. a C++
group), and you asked a Java question here. Why would you do that?
Feb 6 '07 #5
On 2月6日, 上午9时46分, Alan Johnson <a...@yahoo.comwrote:
Allen wrote:
On 2月6日, 上午9时18分, Mark P <use...@fall2005REMOVE.fastmailCAPS.fm>
wrote:
Allen wrote:
In C++, we can do it like this:
void Square(int& value)
{
value *= value;
}
How can I do it in Java?
I try the following method, but it does not work.
void square(Integer value)
{
value = value * value;
}
Why would you ask this in a C++ group? comp.lang.java
It is a java question. Why ask it in C++ group?

That was precisely Mark P's point. This is comp.lang.c++ (i.e. a C++
group), and you asked a Java question here. Why would you do that?

Oh. Sorry, I post it in C++ group.

Feb 6 '07 #6
Mark P wrote:
Allen wrote:
In C++, we can do it like this:

void Square(int& value)
{
value *= value;
}

How can I do it in Java?
Why would you ask this in a C++ group? comp.lang.java

I believe that newsgroup is dead. Google doesn't offer anymore, neither
does NIN.

I would recommend the forums at:

<http://forum.java.sun.com/index.jspa>


Brian
Feb 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ishekara | last post by:
Hi, Can you solve the puzzle for me? I have a main.cpp, testinclude.h, and test1.cpp and test2.cpp which include testinclude.h testinclude.h has a class Include defined. I always thought that...
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
1
by: Chul Min Kim | last post by:
Hi, I'm writing logging functions. I want to use them within my demon program. I'm working on Solaris 7, Sun Sparc Machine. Here are source code....
3
by: Nimmi Srivastav | last post by:
Consider two functions A and B, both of which accept a variable number of arguments (va_start, va-arg, va_end). Is there an easy way for arguments passed to A to be, in turn, passed to B? (For...
22
by: SF | last post by:
Hello All, In a windows C learning project I am wokring on I use the system function to run a command, I want to suck the results into a vairable. The system function seems to only return an...
7
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim...
13
by: Sakula | last post by:
#define MAX 20 /* includes */ #include<iostream.h> #include<stdio.h> #include<malloc.h> #include<string.h>
2
by: Daniel Reardon | last post by:
All, I'm sure that this is an old question, but I'm having problems getting a substring of a passed in variable. I can do other string manipulation with it such as concatonation, but I'm really...
17
by: Summercool | last post by:
I wonder which language allows you to change an argument's value? like: foo(&a) { a = 3 } n = 1 print n
30
by: Adam | last post by:
Hi, I have a simple printf-like function: int print(const char *format, ...) { char buffer; va_list argptr; int i;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.