Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
I cant figure out 2d Arrays.... [Help]
Author Summary
xjboix is in help
Post Body

Im suppose to use 2d arrays to put friends lists names/database number. Then I am suppose to print those.

Then finally i am suppose to compare the 3 arrays created with 3 different prints showing the common friends and how many each person has in common.

common friends and count: Bill/Frank: Malice 1 common friends and count: Bill/Alice: Jim Malice 2 common friends and count: Frank/Alice: Bill Jack Malice 3

   import java.util.Arrays;
   public class Jonny_hw5p1 {

public static void main(String[] args) {


// TODO Auto-generated method stub
    String [] []   jonny  = {{"james","John", "george", 
       "Jesse"},{"Jonny jones", "0"}};
    String [] [] james   = 
       {{"Jonny","Jenna","Jerome","Jesse"},{"James Smith", "1"}};
    String [] []   george = {{"James","Lord","Frank","Freddy"},{"George Davis","2"}};

    Arrays.sort(jonny);

    System.out.println("Jonny's account info. and friendslist: " 
              (Arrays.deepToString(jonny[1])    " "   Arrays.deepToString(jonny[0])));
    Arrays.sort(james);
    System.out.println("James' account info. and friendslist: "   (Arrays.deepToString(james[1])   " "   Arrays.deepToString(james[0] )));
    Arrays.sort(george);
    System.out.println("George's account info. and friendslist: "   (Arrays.deepToString(george[1])   " "   Arrays.deepToString(george[0] )));


    //iterating arrays



    for (int i=0; i< jonny.length;i  ) {
        for(int j=0;j< james.length;j  ) {
            if (jonny[i] == james[j]) {





    System.out.println("Common friends and count: Jonny/James: "   jonny[i]);






            }

} } }

}

Author
Account Strength
90%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
2,206
Link Karma
1,852
Comment Karma
336
Profile updated: 2 days ago
Posts updated: 1 year ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago