What will the following code print out?

public class Test {
   private void division(int a, int b) {
      int result = a / b;
   public static void main(String[] args) {
      division(2, 0);
Compilation error. Method main is static therefore it can't call the non-static method.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes