Click to See Complete Forum and Search --> : aargghhh...[Resolved]
quipy
May 28th, 2003, 04:31 AM
i'm pulling my hair out trying to figure out why a '}' is expected at the end of this line:
public ProductCatalog() {
my code is too long to post here... anyone have any general tips/suggestions why the compiler's saying this?
CornedBee
May 28th, 2003, 04:49 AM
You're probably missing the final } of the class.
Or maybe you're trying to declare multiple classes in one file, that's illegal AFAIK.
quipy
May 28th, 2003, 07:26 AM
import java.util.*;
import java.io.*;
public class AAA {
public AAA() {
String id;
}
}
that's fine.
public class AAA {
public AAA() {
private String id;
}
}
with the private keyword there, an error appears, that says that the '}' is expected, that the method (or constructor) must end... what???
CornedBee
May 28th, 2003, 09:12 AM
Variables inside the constructor cannot have access attributes.
Class variables are declared outside any functions:
public class AAA {
private String id;
public AAA() {
}
}
Note: use tags to post code, it preserves indentation.
From what source are you learning Java?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.