wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes voodoo exam_1 question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

voodoo exam_1 question

bani kaali
Ranch Hand

Joined: May 05, 2002
Posts: 42
By changing which line in the following code can you make the class compile with no errors?
class Xtc {
protected static void main(String args[]) {//line 1
byte b = 10, //line2
c = 10 , //line 3
x= (byte) (b + c) ; //line 4
System.out.println(" x is " + x); //line5
}
}
Options
a) line 1
b) line 2
c) line 3
d) line 4
e) line 5
f) None , the class compiles with no error and prints 20
He says the ans is (f) None
I marked it as (a) since main must to public as the class will compile only if line1 is changed to public static void main ( String args[])
can anyone tell me why the an is none, i tried compiling the program but compiler says main must be public and static.
thanks in advance.
bani
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
The "blatant advertising" forum is really for product announcements. This post seems much more appropriate to one of the study forums,so I've moved it to "Programmer Certification Study" for you.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Please don't post identical threads in multiple forums. Please continue the discussion in the original thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: voodoo exam_1 question