0

Code wont work

Every even number can be expressed as a sum of two prime numbers(12=7+5) and code for the same. But it wont work https://code.sololearn.com/ccPaurEuwIJK/?ref=app

1st Aug 2018, 3:38 PM
Ahan
2 Réponses
0
The problem is at line 48. You should check if c == 1, not 2. This is because your for loop condition is i < j, so i will never reach j, it will max out at j - 1. As a side note, your use of static vs. non-static methods doesn't really make sense to me. You should probably have all of them either non-static or static.
5th Aug 2018, 10:30 AM
Lassi Pulkkinen
Lassi Pulkkinen - avatar
0
Thank you for your help. im fairly new to this and the java lesson mentioned that if a method or a variable has the same value for every instance then its better to declare them static. Hence i thought that print methods, setters and getters shall be static. correct me if I'm wrong and id appreciate of you could redirect me to a link or video
5th Aug 2018, 10:58 AM
Ahan