Solved

Creating a method that accepts two integer arrays as parameters

Posted on 2006-11-19
9
187 Views
Last Modified: 2010-03-31
Can I set up a method to do this? What would it look like?
0
Comment
Question by:msheppard74
  • 3
  • 3
  • 3
9 Comments
 
LVL 1

Expert Comment

by:bnblazer
ID: 17976403
public foo(int[] a, int[] b) {

// do something here

}
0
 
LVL 1

Accepted Solution

by:
bnblazer earned 400 total points
ID: 17976411
actually is would be like this (sorry typed too fast)

public void foo(int[] a, int[] b) {

// do something and assume no return value

}
0
 

Author Comment

by:msheppard74
ID: 17976432
What if I wanted to switch the elements of the two arrays? Usually, one array is longer than the other.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17976483
>>"What if I wanted to switch the elements of the two arrays? Usually, one array is longer than the other."
Can you explain more?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Expert Comment

by:bnblazer
ID: 17976495
If you could give an actual problem statement or some code we could be of much more help.
0
 

Author Comment

by:msheppard74
ID: 17976525
it's a hypothetical at this point. I don't have any code yet. I'm just looking for generic code or pseudo code to get me going.
0
 

Author Comment

by:msheppard74
ID: 17976529
I'm merely wanting to switch the contents of the arrays.
0
 
LVL 16

Assisted Solution

by:suprapto45
suprapto45 earned 100 total points
ID: 17976535
>>"switch the contents of the arrays."
You can loop the first array and compare it with second array and do the necessary logics that you want.
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 17976577
;).

Glad I could help.

David
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to use external config file with Spring MVC 4 61
changePi Challenge 15 77
pairstar challenge 2 42
topping1 challenge 7 53
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now