Anan
Anan

Reputation: 181

Expected unqualified-id before 'public'

public class Main {

static Node root;
static Node current;
static boolean directionRight = false;
static boolean directionLeft = false;

}

It gives an error on line 1. I cant figure out what's the issue. Kindly help. Thanks.

Upvotes: 0

Views: 24741

Answers (1)

Rahul
Rahul

Reputation: 77866

Your declaration of public class Main should just be class Main. remove the public modifier. Also, boolean should be bool as rightly pointed by @HolyBlackCat. Right structure of your class should look like

class Main {
static Node root;
static Node current;
static bool directionRight = false;
static bool directionLeft = false;
}

Upvotes: 3

Related Questions