#Need someone to review my code

1 messages ยท Page 1 of 1 (latest)

supple sinew
#

As the title says, I need someone to review my code
It's not compiling on line 56. This is not my full code I am just trying to work on this specific method to see if it works.

cinder heartBOT
#

<@&987246399047479336> please have a look, thanks.

cinder heartBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

can be fixed. Here is the code:

public class MyClass {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
        int target = 6;
        System.out.println(findPair(arr, target));
    }

    public static boolean findPair(int[] arr, int target) {
        for (int i = 0; i < arr.length; i++) {
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[i] + arr[j] == target) {
                    return true;
                }
            }
        }
        return false;
    }
}

The code seems fine and should compile without any issues. However, without the specific error message or additional context, it is difficult to pinpoint the exact problem on line 56. Please provide more information or the complete code if you need further assistance.

supple sinew
cinder heartBOT
inland furnace
#

Im afraid i can't see line 52 you mentioned as there are no imports and package name

supple sinew
#

i did it right above ur message

#

I know I forgot

inland furnace
#

but i think i know the issue

#

you just need to add a brace at the end of your code

#

}

supple sinew
#

bru

#

i usually have to many so I assumed that

inland furnace
#

you said you have compilation error

#

is there any message on your IDE ?

#

error message

supple sinew
#

it works

#

thanks

inland furnace
supple sinew
#

hey its giving me an error again can you check it out

#

StudentAccount2.java:70: error: reached end of file while parsing

cinder heartBOT
half oracle
#

Please format ur code

sweet hill
#

@supple sinew You forgot a } at the end

#

Here is your code "properly formatted"