What will the following code print out?

public class Test {
   private void division(int a, int b) {
      int result = a / b;
      System.out.println(result);
   }
   public static void main(String[] args) {
      division(2, 0);
   }
}
Explanation
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
Cosmo
Sign Up Now
or Subscribe for future quizzes