Arrays Comments


  • Is there any possible way of making the cheat possible on some of these? All it will let me do is see the hint but won't ever show the cheat button. Fair enough that it's wrong to cheat but since

  • I got the answer in the end, but my first attempt was:

    int CC = ar[ar.length-1];
    int VV = ar[0];
    return CC + VV;

  • @Aaron, I added a little more hint and an explanation.

  • int[] fl = new int[2];
    fl[0] = ar[0];
    fl[1] = ar[ar.length - 1];
    return fl;

  • Thanks for the site I am really learning from it.
    One thing I'd like to be able to do is practice typing things out as I'm following along with your explanations. I think it would help reinforce

  • @Robin, if you just want to take notes I think it would make sense to do in your own note-taking program, though we can consider adding such a feature. Note that if you click on "split-screen

  • Just a funny quote here... On the challenge Second-to-Last i scratched my head for two days trying to think how to declare the variable in a single sentence the reason was because i was understanding: from the second (meaning starting at index 1) to the last, rather than actually thinking about penultimate! Frustrated not being able to declare the variable i decided that i was not understanding the exercise, clear enough google explained me second-to-last=penultimate... OMG LOL

  • What does "Second to last" mean?


  • And here is the answer for the challenge:

    int [] ars = {ar [0], ar [ar.length -1]};
    return ars;

  • these are very good

  • If you get a number from an array, and do not know what slot its in. Is there a code to retrieve the slot?
    I found the largest number in the array and want to know what slot that is in.

  • I don't understand why my challenges are wrong:
    1. int n = numbers[6];
    2. boolean [] frank= new boolean [6];

  • I had the write awnser but it still does not work, what is wrong in this:

    int[] ar2 = new int[2];
    ar2[0] = ar[0];
    ar2[1] = ar[ar.lenght - 1];
    return ar2;

  • sorry i solved it lenght mus be length pfffffffffffff :-)

  • Is the free memebership limit forever? Doesn't it restore after certain time?

  • It doesn't currently restore since it's considered a free trial.

  • Or declare regular variables:

    int a = ar[0];
    int b = ar[ar.length -1];
    int[] az = {a,b};

    return az;

  • Second-to-last means, the second element in the array starting counting from the last index.

  • import java.util.Scanner;
    public class Main(){
    public static void main(String[] args){
    int n;
    int[] numbers= new int[8];
    int[] numbers={2,3,4,5,6,7,8,9};
    for(int i=0;i<8;i=i+1){

  • Do it easy guys ...
    int[] res = {ar[0], ar[ar.length -1]};
    return res;

Contact Us
Sign in or email us at [email protected]