#Need someone to review my code
1 messages ยท Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
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.
I uploaded your attachments as Gist.
hey there!
Im afraid i can't see line 52 you mentioned as there are no imports and package name
but i think i know the issue
you just need to add a brace at the end of your code
}
you said you have compilation error
is there any message on your IDE ?
error message

hey its giving me an error again can you check it out
StudentAccount2.java:70: error: reached end of file while parsing
I uploaded your attachments as Gist.
Please format ur code