This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Hi, All SCJP Candidate help me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Hi, All SCJP Candidate help me" Watch "Hi, All SCJP Candidate help me" New topic
Author

Hi, All SCJP Candidate help me

Guddu Bhai
Greenhorn

Joined: May 11, 2006
Posts: 1
class Emp
{

}
is this valid file is this class compile.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Guddu Bhai:
class Emp
{

}
is this valid file is this class compile.


Yes.

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Hi Guddu.
this is the Servlet forum. Next time, please post to the SCJP forum
Thank you.


[My Blog]
All roads lead to JavaRanch
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Moving to the SCJP Cert forum.
Shaliey Gowtham
Ranch Hand

Joined: Mar 20, 2006
Posts: 104
Even a empty file is a valid java file and will compile.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023

8.1.6 Class Body and Member Declarations
A class body may contain declarations of members of the class, that is, fields (�8.3), classes (�8.5), interfaces (�8.5) and methods (�8.4). A class body may also contain instance initializers (�8.6), static initializers (�8.7), and declarations of constructors (�8.8) for the class.


ClassBody:
{ ClassBodyDeclarationsopt }



ClassBodyDeclarations is "optional".
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
Why not try using the javac compiler to find out if it will compile? Otherwise you will spend your time guessing or waiting for replies for other people when you could be learning.


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hi, All SCJP Candidate help me