{
  "id": "java/arithmeticexception-divide-by-zero",
  "signature": "java.lang.ArithmeticException: / by zero",
  "signature_zh": "java.lang.ArithmeticException: 除以零",
  "regex": "java\\.lang\\.ArithmeticException: / by zero",
  "domain": "java",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Integer division or modulo operation with a zero divisor, which is undefined in integer arithmetic.",
  "root_cause_type": "generic",
  "root_cause_zh": "整数除法或取模运算的除数为零，这在整数算术中未定义。",
  "versions": [
    {
      "version": "Java 8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Using floating-point division (e.g., double) instead of integer division avoids the exception but may produce Infinity or NaN, which can propagate silently.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Simply catching the exception and logging it without fixing the divisor can cause the application to produce incorrect results.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check divisor before division: 'if (divisor == 0) { throw new IllegalArgumentException(\"Division by zero\"); } else { result = dividend / divisor; }'",
      "success_rate": 0.95,
      "how": "Check divisor before division: 'if (divisor == 0) { throw new IllegalArgumentException(\"Division by zero\"); } else { result = dividend / divisor; }'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a safe division utility: 'public static int safeDivide(int a, int b) { if (b == 0) return 0; return a / b; }'",
      "success_rate": 0.85,
      "how": "Use a safe division utility: 'public static int safeDivide(int a, int b) { if (b == 0) return 0; return a / b; }'",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check divisor before division: 'if (divisor == 0) { throw new IllegalArgumentException(\"Division by zero\"); } else { result = dividend / divisor; }'",
    "Use a safe division utility: 'public static int safeDivide(int a, int b) { if (b == 0) return 0; return a / b; }'"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ArithmeticException.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-05-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}