When I run the following java program, I get a compiler error saying it expects a ; on the B() statement. Why this compiler error: Here's the program: [ Formatted code is often much easier to read and understand. I edited this message to surround code with [code] and [/code] UBB Tags in order to help preserve the code formatting. -ds ] [ September 26, 2002: Message edited by: Dirk Schreckmann ]
posted 13 years ago
It looks like you were trying to define the constructor inside of the main method. You can't do that this way. The constructor for class B belongs outside of any method body.Making sense?