- 1
In C we have pointers to return multiple values from a function but how to do it in java??
i am learner so please help me
4 Respostas
+ 1
in c we can return means we can send the values diretly to the adress of required variable.For example take swaping two number program using function
+ 4
How would you return multiple values with a pointer, even in C?
In Java, you return the value:
int a = 5;
int b = 4;
int c = add(a, b);
int add(int a, int b){
return a + b;
}
Java only passes by value with primitive types, so you cannot pass by references with them.
+ 1
vinay lingam it has nothing to do with platform independent nature of java. I have come to know recently.
https://www.sololearn.com/discuss/1351579/?ref=app
0
java was built to avoid pointers, since it was made to become platform independent..