0

Why is this code not working?

I’m trying to total the primes and print the result. It keeps throwing an error where I placed the ^ I don’t understand why. public class Program { public static void main(String[] args) { int[ ] primes = {2, 3, 5, 7}; int total=0; for (int x: primes) { total+=x;} System.out.printIn(total); ^ } }

22nd Nov 2019, 1:01 PM
Quinten
Quinten - avatar
6 RĂ©ponses
+ 2
System.out.println(total); Edit: In println that is a small "L" and not capital "i".
22nd Nov 2019, 1:02 PM
Avinesh
Avinesh - avatar
+ 7
public class Program { public static void main(String[] args) { int[ ] primes = {2, 3, 5, 7}; int total=0; for (int x: primes) { total+=x;} System.out.println(total); } } That's println not printIn you have used in instead of ln
22nd Nov 2019, 1:03 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
Quinten L is capital in println no problem Java is good to start just keep practising
22nd Nov 2019, 1:10 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
Avinesh: Im confused, i have total inside printIn. Gawen: im not seeing any difference in the two you typed? sorry guys, first day learning this!
22nd Nov 2019, 1:07 PM
Quinten
Quinten - avatar
0
the “i” is capitalized in my code. isnt it?
22nd Nov 2019, 1:10 PM
Quinten
Quinten - avatar
0
oh its supposed to be an L?
22nd Nov 2019, 1:11 PM
Quinten
Quinten - avatar