File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes scjp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "scjp" Watch "scjp" New topic


nagaraj reddy
Ranch Hand

Joined: Feb 21, 2005
Posts: 43
private class Base{}

public class Vis{
transient int iVal;
public static void main(String elephant[]){

when we compile it what would be the output

From one mock exam i found that it is error and indicating that Base should not be Private

Is it Correct...........

u can find this question on the link (question NO:7)
Paulo Aquino
Ranch Hand

Joined: Apr 29, 2002
Posts: 202
Top level classes can't be private. This is what ive got when i run your code:

modifier private not allowed here
private class Base{}

Be Afraid...Be very Afraid...
v nithya

Joined: Mar 30, 2005
Posts: 3
In general a top level class cannot be marked with private nor protected access.these top level classes can be marked only as public or can have default access.
(however you can have all these access modifiers for inner classes)
so,ur code gives error.
I agree. Here's the link:
subject: scjp
It's not a secret anymore!