jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt from javaprepare.com Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt from javaprepare.com" Watch "Doubt from javaprepare.com" New topic

Doubt from javaprepare.com

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Language fundamentals tutorial question no. 17
Which of the following are legal Java programs. Select all the correct answer?
A.// The comments come before the package
package pkg;
import java.awt.*;
class C{};
B.package pkg;
import java.awt.*;
class C{};
C.package pkg1;
package pkg2;
import java.awt.*;
class C{};
D.package pkg;
import java.awt.*;
E.import java.awt.*;
class C{};
F.import java.awt.*;
package pkg;
class C {};
Answers he gave: A, B, D, E
My doubt is Do we need semicolon( after class C{};
please someone tell me.
Thank you all in advance

Ranch Hand

Joined: May 26, 2002
Posts: 79
You are right. A semi-colon is NOT required. But it does not hurt either. A semi-colon by itself is an empty statement. It is not illegal.
I agree. Here's the link: http://aspose.com/file-tools
subject: Doubt from javaprepare.com
It's not a secret anymore!