Passing an Array to a Method
+4
ekkoekko
Noob
Hyegi
Admin
8 posters
Page 2 of 2 • 1, 2
- JUNGKOOKGuru
- Posts : 10
Join date : 2018-08-20
Re: Passing an Array to a Method
Mon Aug 20, 2018 4:06 pm
Noob wrote:Hyegi wrote:This is such a good post. I now understand the arrays. Looking forward to your future discussions.
site some examples yhegiiee yhegiiee hahaha
Yah. thankyou for this information
- JUNGKOOKGuru
- Posts : 10
Join date : 2018-08-20
Re: Passing an Array to a Method
Mon Aug 20, 2018 4:06 pm
Thankyou for the information mam, natulungan moko sa assignment ko hahahaha salamaaaaaaaaat
- athenakenjiGuru
- Posts : 10
Join date : 2018-08-20
Re: Passing an Array to a Method
Mon Aug 20, 2018 4:30 pm
JUNGKOOK wrote:Does the basis in lecture are the things to identify the truth or lie?
yes. you may find the answer on the lecture but you may also site more references as your basis.
- athenakenjiGuru
- Posts : 10
Join date : 2018-08-20
Re: Passing an Array to a Method
Mon Aug 20, 2018 4:42 pm
Although Java is strictly pass by value, the precise effect differs between whether a primitive type or a reference type is passed.
When we pass a primitive type to a method, it is passed by value. But when we pass an object to a method, the situation changes dramatically, because objects are passed by what is effectively call-by-reference. Java does this interesting thing that’s sort of a hybrid between pass-by-value and pass-by-reference. Basically, a parameter cannot be changed by the function, but the function can ask the parameter to change itself via calling some method within it.
When we pass a primitive type to a method, it is passed by value. But when we pass an object to a method, the situation changes dramatically, because objects are passed by what is effectively call-by-reference. Java does this interesting thing that’s sort of a hybrid between pass-by-value and pass-by-reference. Basically, a parameter cannot be changed by the function, but the function can ask the parameter to change itself via calling some method within it.
- athenakenjiGuru
- Posts : 10
Join date : 2018-08-20
Re: Passing an Array to a Method
Mon Aug 20, 2018 4:42 pm
example.
#include <stdio.h>
void disp( char ch)
{
printf("%c ", ch);
}
int main()
{
char arr[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
for (int x=0; x<10; x++)
{
/* I’m passing each element one by one using subscript*/
disp (arr[x]);
}
return 0;
}
Output:
a b c d e f g h i j
#include <stdio.h>
void disp( char ch)
{
printf("%c ", ch);
}
int main()
{
char arr[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
for (int x=0; x<10; x++)
{
/* I’m passing each element one by one using subscript*/
disp (arr[x]);
}
return 0;
}
Output:
a b c d e f g h i j
Re: Passing an Array to a Method
Wed Aug 22, 2018 4:24 pm
JUNGKOOK wrote:Does the basis in lecture are the things to identify the truth or lie?
you may use the lecture as your basis but you can also site or search on the internet . verygood question.
Re: Passing an Array to a Method
Wed Aug 22, 2018 4:28 pm
JUNGKOOK wrote:Noob wrote:Noob wrote:Noob wrote:Hyegi wrote:This is such a good post. I now understand the arrays. Looking forward to your future discussions.
can you site some examples
nakasearch ako sa youtube ng mga examples ng ganun napakaangas ka mo gusto mo mapanood>>??
maangas kamo un pre napakaangas nung array kung paano siya nakokonekta sa data base para mas mabilis na mapaunlad ang sistema
HAHAHAHAHA
continue watching examples in youtube. mas madaming examples dun. mas maiintindihan nyo ng malalim yung topic natin. very good.
Page 2 of 2 • 1, 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|