+ 1
What is the output of following code? Explain.
public class program { final int y; public static void main(String args[]) { final int x; y=3; x=6; System.out.print(x%y); } }
3 Respostas
+ 6
You'll get an error, because you can't access a non-static variable or method from a static method. once you change y to static it will output 0.
0
Probably de running will failed because you need to declare the "y" inside the main method
0
int x cannot be final, because it is a local variable that inside main method.