An error keeps coming like ; needed in public static void.someone help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

An error keeps coming like ; needed in public static void.someone help

import java.util.Scanner; public class IfElse { public static void main (String args []) Scanner input = new Scanner(System.in); { System.out.println ("enter any number"); { int x; x = input.nextInt(); if (x==2) {System.out.println ("no");} else {System.out.println("there you go");} } } }

6th Aug 2019, 4:47 PM
Ankush Raj
Ankush Raj - avatar
2 Answers
+ 5
"{" from row 6 should be right after main from row 4
6th Aug 2019, 4:52 PM
notqueued
notqueued - avatar
0
public static void main (String args []) { //added bracket Scanner input = new Scanner(System.in); //{
6th Aug 2019, 8:09 PM
zemiak