Bookmark Topic Watch Topic
  • New Topic

voodoo exam_1 question

 
bani kaali
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
    Bookmark Topic Watch Topic
  • New Topic