Jump to content

Java Kodlama Copyarray Sorunu


oguzca
 Share

Recommended Posts

Arkadaşlar haftalık assignment'im için javada bir method yazmam gerekli. kodu yazdım ama bi noktada tıkandım bana bu konuda yardım edebilecek arkadaşlara minnettar kalırım. Kod şu şekilde. ama bunu nasıl çalıştıracağımı bulamadım... :/

[codebox] public double[][] copyArray(double[][] source, double[][] target){//this method came from interface
double[][] nums= new double[3][3];
double[][] copy = new double[nums.length][];
for (int i = 0; i < nums.length; i++){
copy[i] = new double[nums[i].length];
for (int j = 0; j < nums[i].length; j++){
copy[i][j] = nums[i][j];
}
}
return copy;
}
}[/codebox] Edited by oguzca
Link to comment
Share on other sites

[code]public double[][] copyArray(double[][] source){//this method came from interface
double[][] copy = new double[source.length][];
for (int i = 0; i < source.length; i++){
for (int j = 0; j < source[i].length; j++){
copy[i][j] = source[i][j];
}
}
return copy;
}
}
[/code]

Hiç bi java bilgim yok ama biraz programlama mantığımdan bunu yazdım.Fakat anlamadığım iki nokta var Target parametresini kullanmamışsın?Ne işe yarıyor?Ayrıca diyelim ki arrayı kopyaladın ne işine yarayacak?Zaten elinde olanı iki yerde kullanamıyor musun :D

Edited by MostWanted
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...