Incorrect start of type?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Incorrect start of type??

import java.util.Random; public class Program { public static void main(String[] args) { Random rnd = new Random (); int you = rnd.nextInt (6); int AI = rnd.nextInt (6); System.out.println("You: " + you); System.out.println("Opponent: " + AI); if(you>AI) System.out.println("You won!"); } else { System.out.println("you lost"); } } Apparantly the else is an incorrect start of type? Can you please help?

22nd May 2020, 1:00 AM
Code214
Code214 - avatar
2 Answers
+ 4
You lack an opening curly brace on if statement. if (you>AI) {
22nd May 2020, 1:13 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
... Why didn’t I see that! Thanks soooo much!
22nd May 2020, 1:25 AM
Code214
Code214 - avatar