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 be public as the class will compile only if line1 is changed to public static void main ( String args[])
can anyone tell me why the answer is none, i tried compiling the program but compiler says main must be public and static.
thanks in advance.
bani