- 1

Can you explain the most easist way to call array in a object with the help of example

I dont undrestant how array can be called in object multiple time in a different methods

11th Feb 2017, 10:35 AM
kapil yadav
kapil yadav - avatar
5 ответов
+ 3
We can only help you if you post the code
11th Feb 2017, 12:01 PM
Abishek Bashyal
Abishek Bashyal - avatar
0
Could you please clarify your question?
11th Feb 2017, 11:11 AM
Nəzər Nəsirzadə
Nəzər Nəsirzadə - avatar
0
How to call a array into a object..explain with eg
11th Feb 2017, 11:13 AM
kapil yadav
kapil yadav - avatar
0
I don't understand exactly what you mean. If you want to pass an array to a custom class, then define constructor which takes array as an argument.
11th Feb 2017, 11:22 AM
Nəzər Nəsirzadə
Nəzər Nəsirzadə - avatar
- 1
if you want to call a method by passing array then : class A{ int[] a; public void takeArry(int[] a){ this.a = a;} public static void main(String... arg){ A newA = new A(); newA.takeArry(new int[]{1,2,3,4}); System.out.println(a), }}
11th Feb 2017, 12:24 PM
Abhishek C Prajapati
Abhishek C Prajapati - avatar