This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes int array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "int array" Watch "int array" New topic

int array

kofi ofei
Ranch Hand

Joined: May 22, 2005
Posts: 39
it compiles but when i run it nothing seems to be happening

class IntArray{
private native int sumArray(int arr[]);
public static void main(String args[]){
IntArray p = new IntArray();
int arr[] = new int [10];
for (int i = 0; i < 10; i++)
arr[i] = i;
int sum = p.sumArray(arr);
System.out.println("sum = " + sum);
static {
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17271

sumArray method doesn't do anything, so nothing will happen.

Moving to Java In General (Beginner) forum.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: int array
It's not a secret anymore!