0
Can anyone help me fix this im new to class i want 2 classes "helloandbye" and "names" but its not working. Thanks
public class HelloAndBye { static String x; static String y; public class Names { static string a; static string b; public static void main(String[] args) { String x = "Hello "; String y = "Bye "; System.out.println(x); a= "Harry"; b= "Tony"; System.out.println(a); } } }
6 Answers
+ 2
If you didn't want nested then you need to end the first class's block with a }, before the class Names.
Example/
class a
{
}
class b
{
}
0
Just capitalize the type definition of a and b --> static String a;
As you did with x and y.
0
i did that but its saying that its an illegal static inside inner class :/
0
You want this to be nested class or normal class?
0
normal please :)
0
@Rrestoringfaith that worked great thanks!, may i ask what nested means? thanks