|
-
May 28th, 2003, 04:31 AM
#1
Thread Starter
Lively Member
aargghhh...[Resolved]
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?
Last edited by Dilenger4; Jun 27th, 2003 at 09:47 PM.
-
May 28th, 2003, 04:49 AM
#2
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 28th, 2003, 07:26 AM
#3
Thread Starter
Lively Member
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???
-
May 28th, 2003, 09:12 AM
#4
Variables inside the constructor cannot have access attributes.
Class variables are declared outside any functions:
Code:
public class AAA {
private String id;
public AAA() {
}
}
Note: use [code][/code] tags to post code, it preserves indentation.
From what source are you learning Java?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|