{"id":11491,"date":"2021-05-28T10:00:00","date_gmt":"2021-05-28T10:00:00","guid":{"rendered":"https:\/\/stackify.com\/?p=11491"},"modified":"2024-03-05T11:48:14","modified_gmt":"2024-03-05T11:48:14","slug":"top-java-software-errors","status":"publish","type":"post","link":"https:\/\/stackify.com\/top-java-software-errors\/","title":{"rendered":"Top Java Software Errors: 50 Common Java Errors and How to Avoid Them"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Imagine, you are developing Java software and suddenly you encounter an error? Where could you have possibly gone wrong?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are many types of<\/span><a href=\"https:\/\/stackify.com\/error-monitoring\/\"> <span style=\"font-weight: 400;\">errors<\/span><\/a><span style=\"font-weight: 400;\"> that you will encounter while developing Java software, but most are avoidable. Some errors are minor lapses when writing codes but that is very much mendable. If you have an error monitoring tool such as <\/span><a href=\"https:\/\/stackify.com\/retrace\/\"><span style=\"font-weight: 400;\">Stackify Retrace<\/span><\/a><span style=\"font-weight: 400;\">, you can write codes with ease.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this article you will find:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">50 of the most common Java software errors<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Code examples and tutorials to help you work around common coding problems<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read on to learn about the most common issues and their workarounds.<\/span><\/p>\n<h2><b>Compiler Errors<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Compiler error messages are created when the Java software code is run through the compiler. It is important to remember that a compiler may throw many error messages for one error. So, fix the first error and recompile. That could solve many problems.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">\u00a0<\/span><b>1. \u201c\u2026 expected\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This error occurs when something is missing from the code. Often this is created by a missing semicolon or closing parenthesis.<\/span><\/p>\n<pre class=\"prettyprint\">private static double volume(String solidom, double alturam, double areaBasem, double raiom) {\ndouble vol;\n\n    if (solidom.equalsIgnoreCase(\"esfera\"){\n        vol=(4.0\/3)*Math.pi*Math.pow(raiom,3);\n    }\n    else {\n        if (solidom.equalsIgnoreCase(\"cilindro\") {\n            vol=Math.pi*Math.pow(raiom,2)*alturam;\n        }\n        else {\n            vol=(1.0\/3)*Math.pi*Math.pow(raiom,2)*alturam;\n        }\n    }\n    return vol;\n}\n<\/pre>\n<p><span style=\"font-weight: 400;\">Often this error message does not pinpoint the exact location of the issue. To find it:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Make sure all opening parenthesis have a corresponding closing parenthesis.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Look in the line previous to the Java code line indicated. This Java software error doesn\u2019t get noticed by the compiler until further in the code.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Sometimes a character such as an opening parenthesis shouldn\u2019t be in the Java code in the first place. So the developer didn\u2019t place a closing parenthesis to balance the parentheses.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Check ut an example of<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/19752135\/java-expected-error\"> <span style=\"font-weight: 400;\">how a missed parenthesis<\/span><\/a><span style=\"font-weight: 400;\"> can create an error (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<h3><b>2. \u201cunclosed string literal\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cunclosed string literal\u201d error message is created when the string literal ends without quotation marks and the message will appear on the same<\/span><a href=\"http:\/\/www.dreamincode.net\/forums\/topic\/116743-unclosed-string-literal-error\/\"> <span style=\"font-weight: 400;\">line as the error<\/span><\/a><span style=\"font-weight: 400;\">. (@DreamInCode) A literal is a source code of a value.<\/span><\/p>\n<pre class=\"prettyprint\"> public abstract class NFLPlayersReference {\n\n    private static Runningback[] nflplayersreference;\n\n    private static Quarterback[] players;\n\n    private static WideReceiver[] nflplayers;\n\n    public static void main(String args[]){\n\n    Runningback r = new Runningback(\"Thomlinsion\");\n\n    Quarterback q = new Quarterback(\"Tom Brady\");\n\n    WideReceiver w = new WideReceiver(\"Steve Smith\");\n\n    NFLPlayersReference[] NFLPlayersReference;\n\n\n        Run();\/\/ {\n\n        NFLPlayersReference = new NFLPlayersReference [3];\n\n        nflplayersreference[0] = r;\n\n        players[1] = q;\n\n        nflplayers[2] = w;\n \n\n            for ( int i = 0; i &lt; nflplayersreference.length; i++ ) {\n\n            System.out.println(\"My name is \" + \" nflplayersreference[i].getName());\n\n            nflplayersreference[i].run();\n\n            nflplayersreference[i].run();\n\n            nflplayersreference[i].run();\n\n            System.out.println(\"NFL offensive threats have great running abilities!\");\n\n        }\n\n    }\n\n    private static void Run() {\n\n        System.out.println(\"Not yet implemented\");\n\n    }     \n \n}\n<\/pre>\n<p><span style=\"font-weight: 400;\">Commonly, this happens when:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">The string literal does not end with quote marks. This is easy to correct by closing the string literal with the needed quote mark.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">The string literal extends beyond a line. Long string literals can be broken into multiple literals and concatenated with a plus sign (\u201c+\u201d).<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">Quote marks that are part of the string literal are not escaped with a backslash (\u201c\\\u201d).<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read a<\/span><a href=\"https:\/\/www.quora.com\/What-is-an-unclosed-string-literal\"> <span style=\"font-weight: 400;\">discussion of the unclosed string literal<\/span><\/a><span style=\"font-weight: 400;\"> Java software error message. (<\/span><a href=\"https:\/\/twitter.com\/Quora\"><span style=\"font-weight: 400;\">@Quora<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>3. \u201cillegal start of an expression\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">There are numerous reasons why an \u201cillegal start of an expression\u201d error occurs. It ends up being one of the less-helpful error messages. Some developers say it\u2019s caused by bad code.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Usually, expressions are created to produce a new value or assign a value to a variable. The compiler expects to find an expression and cannot find it because the<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/19581173\/java-getting-illegal-start-of-expression-and-expected-errors-for-a-metho\"> <span style=\"font-weight: 400;\">syntax does not match expectations<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">) It is in these statements that the error can be found.<\/span><\/p>\n<pre class=\"prettyprint\">} \/\/ ADD IT HERE\n\n       public void newShape(String shape) {\n\n        switch (shape) {\n            case \"Line\":\n                Shape line = new Line(startX, startY, endX, endY);\n            shapes.add(line);\n            break;\n                case \"Oval\":\n            Shape oval = new Oval(startX, startY, endX, endY);\n            shapes.add(oval);\n            break;\n            case \"Rectangle\":\n            Shape rectangle = new Rectangle(startX, startY, endX, endY);\n            shapes.add(rectangle);\n            break;\n            default:\n            System.out.println(\"ERROR. Check logic.\");\n        }\n        }\n    } \/\/ REMOVE IT FROM HERE\n    }\n<\/pre>\n<p><span style=\"font-weight: 400;\">Browse discussions of<\/span><a href=\"https:\/\/stackoverflow.com\/search?q=%22illegal+start+of+an+expression%22+java\"> <span style=\"font-weight: 400;\">how to troubleshoot the \u201cillegal start of an expression\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>4. \u201ccannot find symbol\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This is a very common issue because all identifiers in Java need to be declared before they are used. When the code is being compiled, the compiler does not understand what the identifier means.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-11495 size-full\" src=\"https:\/\/stackify.com\/wp-content\/uploads\/2017\/05\/cannot-find-symbol-error-screenshot-11495.jpg\" alt=\"&quot;cannot find symbol&quot; Java software error\" width=\"500\" height=\"280\" \/><\/p>\n<p><span style=\"font-weight: 400;\">There are many reasons you might receive the \u201ccannot find symbol\u201d message:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">The spelling of the identifier when declared may not be the same as when it is used in the code.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The variable was never declared.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The variable is not being used in the same scope it was declared.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The class was not imported.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read a thorough<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/25706216\/what-does-a-cannot-find-symbol-compilation-error-mean\"> <span style=\"font-weight: 400;\">discussion of the \u201ccannot find symbol\u201d error<\/span><\/a><span style=\"font-weight: 400;\"> and several code examples that create the same issue. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>5. \u201cpublic class XXX should be in file\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cpublic class XXX should be in file\u201d message occurs when the class XXX and the Java program filename<\/span><a href=\"https:\/\/coderanch.com\/t\/628555\/java\/Netbeans-static-variables\"> <span style=\"font-weight: 400;\">do not match<\/span><\/a><span style=\"font-weight: 400;\">. The code will only be compiled when the class and Java file are the same. (<\/span><a href=\"https:\/\/twitter.com\/coderanch\"><span style=\"font-weight: 400;\">@coderanch<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<pre class=\"prettyprint\">package javaapplication3;  \n   \n \n  public class Robot {  \n        int xlocation;  \n        int ylocation;  \n        String name;  \n        static int ccount = 0;  \n           \n        public Robot(int xxlocation, int yylocation, String nname) {  \n            xlocation = xxlocation;  \n            ylocation = yylocation;  \n            name = nname;  \n            ccount++;         \n        } \n  }\n         \n  public class JavaApplication1 { \n       \n       \n       \n    public static void main(String[] args) {  \n           \n        robot firstRobot = new Robot(34,51,\"yossi\");  \n        System.out.println(\"numebr of robots is now \" + Robot.ccount);  \n    }\n  }\n<\/pre>\n<p><span style=\"font-weight: 400;\">To fix this issue:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Name the class and file the same.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Make sure the case of both names is consistent.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">See an<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/13811020\/java-class-is-public-should-be-declared-in-a-file-named\"> <span style=\"font-weight: 400;\">example of the \u201cPublic class XXX should be in file\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error. (@StackOverflow)<\/span><\/p>\n<h3><b>6. \u201cincompatible types\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u201cIncompatible types\u201d is an error in logic that occurs when an assignment statement tries to pair a variable with an expression of types. It often comes when the code tries to place a<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/18861044\/what-is-wrong-with-this-incompatible-type-error\"> <span style=\"font-weight: 400;\">text string into an integer<\/span><\/a><span style=\"font-weight: 400;\"> \u2014 or vice versa. This is not a Java syntax error. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<pre class=\"prettyprint\">test.java:78: error: incompatible types\nreturn stringBuilder.toString();\n                             ^\nrequired: int\nfound:    String\n1 error\n<\/pre>\n<p><span style=\"font-weight: 400;\">There really isn\u2019t an easy fix when the compiler gives an \u201cincompatible types\u201d message:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">There are functions that can convert types.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Developer may need to change what the code is expected to do.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Check out an example of<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/7466133\/java-error-incompatible-types-message\"> <span style=\"font-weight: 400;\">how trying to assign a string to an integer created the \u201cincompatible types.\u201d<\/span><\/a><span style=\"font-weight: 400;\">\u00a0 (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>7. \u201cinvalid method declaration; return type required\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message means the return type of a method was not explicitly stated in the method signature.<\/span><\/p>\n<pre class=\"prettyprint\">public class Circle\n{\n    private double radius;\n    public CircleR(double r)\n    {\n        radius = r;\n    }\n    public diameter()\n    {\n       double d = radius * 2;\n       return d;\n    }\n}\n<\/pre>\n<p><span style=\"font-weight: 400;\">There are a few ways to trigger the \u201cinvalid method declaration; return type required\u201d error:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Forgetting to state the type<\/span><\/li>\n<li><span style=\"font-weight: 400;\">If the method does not return a value then \u201cvoid\u201d needs to be stated as the type in the method signature.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Constructor names do not need to state type. But if there is an error in the constructor name, then the compiler will treat the constructor as a method without a stated type.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Follow an example of<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/7451707\/java-error-invalid-method-declaration-return-type-required\"> <span style=\"font-weight: 400;\">how constructor naming triggered the \u201cinvalid method declaration; return type required\u201d<\/span><\/a><span style=\"font-weight: 400;\"> issue. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>8. \u201cmethod &lt;X&gt; in class &lt;Y&gt; cannot be applied to given types\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message is one of the more helpful error messages. It explains how the method signature is calling the wrong parameters.<\/span><\/p>\n<pre class=\"prettyprint\">RandomNumbers.java:9: error: method generateNumbers in class RandomNumbers cannot be applied to given types;\ngenerateNumbers();\n\nrequired: int[]\n\nfound:generateNumbers();\n\nreason: actual and formal argument lists differ in length\n<\/pre>\n<p><span style=\"font-weight: 400;\">The method called is expecting certain arguments defined in the method\u2019s declaration. Check the method declaration and call carefully to make sure they are compatible.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This discussion illustrates<\/span><a href=\"https:\/\/stackoverflow.com\/questions\/13169606\/method-in-class-cannot-be-applied-to-given-types\"> <span style=\"font-weight: 400;\">how a Java software error message identifies the incompatibility created by arguments<\/span><\/a><span style=\"font-weight: 400;\"> in the method declaration and method call. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>9. \u201cmissing return statement\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cmissing return statement\u201d message occurs when a method does not have a return statement. Each method that returns a value (a non-void type) must have a statement that literally returns that value so it can be called outside the method.<\/span><\/p>\n<pre class=\"prettyprint\">public String[] OpenFile() throws IOException {\n\n    Map&lt;String, Double&gt; map = new HashMap();\n\n    FileReader fr = new FileReader(\"money.txt\");\n    BufferedReader br = new BufferedReader(fr);\n\n\n    try{\n        while (br.ready()){\n            String str = br.readLine();\n            String[] list = str.split(\" \");\n            System.out.println(list);               \n        }\n    }   catch (IOException e){\n        System.err.println(\"Error - IOException!\");\n    }\n}\n<\/pre>\n<p><span style=\"font-weight: 400;\">There are a couple of reasons why a compiler throws the \u201cmissing return statement\u201d message:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">A return statement was simply omitted by mistake.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The method did not return any value but type void was not declared in the method signature.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Check out an example of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/21256469\/java-missing-return-statement\"><span style=\"font-weight: 400;\">how to fix the \u201cmissing return statement\u201d Java software error<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>10. \u201cpossible loss of precision\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u201cPossible loss of precision\u201d occurs when more information is assigned to a variable than it can hold. If this happens, pieces will be thrown out. If this is fine, then the code needs to explicitly declare the variable as a new type.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A \u201cpossible loss of precision\u201d error commonly occurs when:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">Trying to assign a real number to a variable with an integer data type.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">Trying to assign a double to a variable with an integer data type.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">This <\/span><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/datatypes.html\"><span style=\"font-weight: 400;\">explanation of Primitive Data Types in Java<\/span><\/a><span style=\"font-weight: 400;\"> shows how the data is characterized. (<\/span><a href=\"https:\/\/twitter.com\/Oracle\"><span style=\"font-weight: 400;\">@Oracle<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>11. \u201creached end of file while parsing\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This error message usually occurs in Java when the program is missing the closing curly brace (\u201c}\u201d). Sometimes it can be quickly fixed by placing it at the end of the code.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">class<\/span><span style=\"font-weight: 400;\"> mod_MyMod <\/span><span style=\"font-weight: 400;\">extends<\/span> <span style=\"font-weight: 400;\">BaseMod<\/span>\n\n<span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">String<\/span> <span style=\"font-weight: 400;\">Version<\/span><span style=\"font-weight: 400;\">()<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">\"1.2_02\"<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">void<\/span> <span style=\"font-weight: 400;\">AddRecipes<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">CraftingManager<\/span><span style=\"font-weight: 400;\"> recipes<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0recipes<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">addRecipe<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">new<\/span> <span style=\"font-weight: 400;\">ItemStack<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">Item<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">diamond<\/span><span style=\"font-weight: 400;\">),<\/span> <span style=\"font-weight: 400;\">new<\/span> <span style=\"font-weight: 400;\">Object<\/span><span style=\"font-weight: 400;\">[]<\/span> <span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span> <span style=\"font-weight: 400;\">\"#\"<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">Character<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">valueOf<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">'#'<\/span><span style=\"font-weight: 400;\">),<\/span> <span style=\"font-weight: 400;\">Block<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">dirt<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">});<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The above code results in the following error:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">11<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> reached <\/span><span style=\"font-weight: 400;\">end<\/span> <span style=\"font-weight: 400;\">of<\/span><span style=\"font-weight: 400;\"> file <\/span><span style=\"font-weight: 400;\">while<\/span><span style=\"font-weight: 400;\"> parsing <\/span><span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Coding utilities and proper code indenting can make it easier to find these unbalanced braces.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This example shows <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/4934412\/java-compile-error-reached-end-of-file-while-parsing\"><span style=\"font-weight: 400;\">how missing braces can create the \u201creached end of file while parsing\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error message. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>12. \u201cunreachable statement\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u201cUnreachable statement\u201d occurs when a statement is written in a place that prevents it from being executed. Usually, this is after a break or return statement.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">for<\/span><span style=\"font-weight: 400;\">(;;){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">break<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">...<\/span> <span style=\"font-weight: 400;\">\/\/ unreachable statement<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> i<\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">if<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">i<\/span><span style=\"font-weight: 400;\">==<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">...<\/span>\n\n<span style=\"font-weight: 400;\">else<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">...<\/span> <span style=\"font-weight: 400;\">\/\/ dead code<\/span>\n\n<span style=\"font-weight: 400;\">Often simply moving the return statement will fix the error. Read the discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/18308159\/unreachable-statement-compile-error-in-java\"><span style=\"font-weight: 400;\">how to fix unreachable statement Java software error<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<h3><b>13. \u201cvariable &lt;X&gt; might not have been initialized\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This occurs when a local variable declared within a method has not been initialized. It can occur when a variable without an initial value is part of an if statement.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> x<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">if<\/span> <span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">condition<\/span><span style=\"font-weight: 400;\">)<\/span> <span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">x <\/span><span style=\"font-weight: 400;\">=<\/span> <span style=\"font-weight: 400;\">5<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">System<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">out<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">println<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">x<\/span><span style=\"font-weight: 400;\">);<\/span> <span style=\"font-weight: 400;\">\/\/ x may not have been initialized<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/www.reddit.com\/r\/learnprogramming\/comments\/1njfui\/java_error_variable_x_might_not_have_been\/\"><span style=\"font-weight: 400;\">how to avoid triggering the \u201cvariable &lt;X&gt; might not have been initialized\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error. (<\/span><a href=\"https:\/\/twitter.com\/reddit\"><span style=\"font-weight: 400;\">@reddit<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>14. \u201cOperator .. cannot be applied to &lt;X&gt;\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This issue occurs when operators are used for types, not in their definition.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">operator<\/span> <span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\"> cannot be applied to java<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">lang<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">Object<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">lang<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">Object<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This often happens when the Java code tries to use a type string in a calculation. To fix it, the string needs to be converted to an integer or float.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this example of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/26890817\/error-operator-cannot-be-applied\"><span style=\"font-weight: 400;\">how non-numeric types were causing a Java software error warning<\/span><\/a><span style=\"font-weight: 400;\"> that an operator cannot be applied to a type. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>15. \u201cinconvertible types\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cinconvertible types\u201d error occurs when the Java code tries to perform an illegal conversion.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">TypeInvocationConversionTest<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">12<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> inconvertible types<\/span>\n\n<span style=\"font-weight: 400;\">found \u00a0 <\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> java<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">util<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">ArrayList<\/span><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">lang<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">Class<\/span><span style=\"font-weight: 400;\">&lt;?<\/span> <span style=\"font-weight: 400;\">extends<\/span> <span style=\"font-weight: 400;\">TypeInvocationConversionTest<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">Interface1<\/span><span style=\"font-weight: 400;\">&gt;&gt;<\/span>\n\n<span style=\"font-weight: 400;\">required<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> java<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">util<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">ArrayList<\/span><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">lang<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">Class<\/span><span style=\"font-weight: 400;\">&lt;?&gt;&gt;<\/span>\n\n<span style=\"font-weight: 400;\">lessRestrictiveClassList <\/span><span style=\"font-weight: 400;\">=<\/span> <span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">ArrayList<\/span><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">Class<\/span><span style=\"font-weight: 400;\">&lt;?&gt;&gt;)<\/span><span style=\"font-weight: 400;\"> classList<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">^<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">For example, booleans cannot be converted to an integer.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/19138960\/is-there-any-way-to-convert-these-inconvertible-types\"><span style=\"font-weight: 400;\">finding ways to convert inconvertible types<\/span><\/a><span style=\"font-weight: 400;\"> in Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>16. \u201cmissing return value\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">You\u2019ll get the \u201cmissing return value\u201d message when the return statement includes an incorrect type. For example, the following code:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">class<\/span> <span style=\"font-weight: 400;\">SavingsAcc2<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">private<\/span> <span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> balance<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">private<\/span> <span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> interest<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\">()<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">balance <\/span><span style=\"font-weight: 400;\">=<\/span> <span style=\"font-weight: 400;\">0.0<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">interest <\/span><span style=\"font-weight: 400;\">=<\/span> <span style=\"font-weight: 400;\">6.17<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> initBalance<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> interested<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">balance <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> initBalance<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">interest <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> interested<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\"> deposit<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> amount<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">balance <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> balance <\/span><span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\"> amount<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\"> withdraw<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> amount<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">balance <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> balance <\/span><span style=\"font-weight: 400;\">-<\/span><span style=\"font-weight: 400;\"> amount<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\"> addInterest<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> interest<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">balance <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> balance <\/span><span style=\"font-weight: 400;\">*<\/span> <span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">interest <\/span><span style=\"font-weight: 400;\">\/<\/span> <span style=\"font-weight: 400;\">100<\/span><span style=\"font-weight: 400;\">)<\/span> <span style=\"font-weight: 400;\">+<\/span><span style=\"font-weight: 400;\"> balance<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">double<\/span><span style=\"font-weight: 400;\"> getBalance<\/span><span style=\"font-weight: 400;\">()<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\"> balance<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">Returns the following error:<\/span>\n\n<span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">29<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> missing <\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">value<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">^<\/span>\n\n<span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">35<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> missing <\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">value<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">^<\/span>\n\n<span style=\"font-weight: 400;\">SavingsAcc2<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">java<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">41<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> missing <\/span><span style=\"font-weight: 400;\">return<\/span> <span style=\"font-weight: 400;\">value<\/span>\n\n<span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">^<\/span>\n\n<span style=\"font-weight: 400;\">3<\/span><span style=\"font-weight: 400;\"> errors<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Usually, there is a return statement that doesn\u2019t return anything.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/coderanch.com\/t\/566414\/java\/missing-return-error\"><span style=\"font-weight: 400;\">how to avoid the \u201cmissing return value\u201d<\/span><\/a><span style=\"font-weight: 400;\"> Java software error message. (<\/span><a href=\"https:\/\/twitter.com\/coderanch\"><span style=\"font-weight: 400;\">@coderanch<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>17. \u201ccannot return a value from method whose result type is void\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java error occurs when a void method tries to return any value, such as in the following example:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">static<\/span> <span style=\"font-weight: 400;\">void<\/span><span style=\"font-weight: 400;\"> move<\/span><span style=\"font-weight: 400;\">()<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">System<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">out<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">println<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"What do you want to do?\"<\/span><span style=\"font-weight: 400;\">);<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">Scanner<\/span><span style=\"font-weight: 400;\"> scan <\/span><span style=\"font-weight: 400;\">=<\/span> <span style=\"font-weight: 400;\">new<\/span> <span style=\"font-weight: 400;\">Scanner<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">System<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">in<\/span><span style=\"font-weight: 400;\">);<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> userMove <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> scan<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">nextInt<\/span><span style=\"font-weight: 400;\">();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\"> userMove<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">static<\/span> <span style=\"font-weight: 400;\">void<\/span><span style=\"font-weight: 400;\"> usersMove<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">String<\/span><span style=\"font-weight: 400;\"> playerName<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> gesture<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> userMove <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> move<\/span><span style=\"font-weight: 400;\">();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if<\/span> <span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">userMove <\/span><span style=\"font-weight: 400;\">==<\/span> <span style=\"font-weight: 400;\">-<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span> <span style=\"font-weight: 400;\">break<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Often this is fixed by changing to method signature to match the type in the return statement. In this case, instances of void can be changed to int:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public<\/span> <span style=\"font-weight: 400;\">static<\/span> <span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> move<\/span><span style=\"font-weight: 400;\">()<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">System<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">out<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">println<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">\"What do you want to do?\"<\/span><span style=\"font-weight: 400;\">);<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">Scanner<\/span><span style=\"font-weight: 400;\"> scan <\/span><span style=\"font-weight: 400;\">=<\/span> <span style=\"font-weight: 400;\">new<\/span> <span style=\"font-weight: 400;\">Scanner<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">System<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">in<\/span><span style=\"font-weight: 400;\">);<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\"> userMove <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> scan<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">nextInt<\/span><span style=\"font-weight: 400;\">();<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">return<\/span><span style=\"font-weight: 400;\"> userMove<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/15518399\/cannot-return-a-value-from-method-whose-result-type-is-void-error\"><span style=\"font-weight: 400;\">how to fix the \u201ccannot return a value from method whose result type is void\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>18. \u201cnon-static variable . . . cannot be referenced from a static context\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This error occurs when the compiler tries to <\/span><a href=\"https:\/\/javarevisited.blogspot.com\/2012\/02\/why-non-static-variable-cannot-be.html\"><span style=\"font-weight: 400;\">access non-static variables from a static method<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/javinpaul\"><span style=\"font-weight: 400;\">@javinpaul<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">StaticTest {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">private int <\/span><span style=\"font-weight: 400;\">count<\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String args[]) <\/span><span style=\"font-weight: 400;\">throws <\/span><span style=\"font-weight: 400;\">IOException {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">count<\/span><span style=\"font-weight: 400;\">++<\/span><span style=\"font-weight: 400;\">; <\/span><span style=\"font-weight: 400;\">\/\/compiler error: non-static variable count cannot be referenced from a static context<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">To fix the \u201cnon-static variable . . . cannot be referenced from a static context\u201d error, try these two things:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Declare the variable as static in the signature.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Check on the code as it can create an instance of a non-static object in the static method.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this tutorial that explains <\/span><a href=\"http:\/\/www.sitesbay.com\/java\/java-static-and-non-static-variable\"><span style=\"font-weight: 400;\">what is the difference between static and non-static variables<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/sitesbay\"><span style=\"font-weight: 400;\">@sitesbay<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>19. \u201cnon-static method . . . cannot be referenced from a static context\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This issue occurs when the Java code tries to call a non-static method in a non-static class. Here is an example:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">Sample<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">private int <\/span><span style=\"font-weight: 400;\">age<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0public void <\/span><span style=\"font-weight: 400;\">setAge<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">a)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">age<\/span><span style=\"font-weight: 400;\">=a<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public int <\/span><span style=\"font-weight: 400;\">getAge<\/span><span style=\"font-weight: 400;\">()<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">return <\/span><span style=\"font-weight: 400;\">age<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String args[])<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.println(\u201cAge is:\u201d+ getAge())<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Would return this error:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.lang.Error: Unresolved compilation problem:<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Cannot make a <\/span><span style=\"font-weight: 400;\">static <\/span><span style=\"font-weight: 400;\">reference to the non\u2013<\/span><span style=\"font-weight: 400;\">static <\/span><span style=\"font-weight: 400;\">method getAge() from the type Sample<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">To call a non-static method from a static method is to declare an instance of the class calling the non-static method.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this explanation on <\/span><a href=\"http:\/\/beginnersbook.com\/2013\/05\/static-vs-non-static-methods\/\"><span style=\"font-weight: 400;\">what is the difference between non-static methods and static methods<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3><b>20. \u201c(array) &lt;X&gt; not initialized\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">You\u2019ll get the \u201c(array) &lt;X&gt; not initialized\u201d message when an array has been declared but not initialized. Arrays are fixed in length so each <\/span><span style=\"font-weight: 400;\">array <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/5387643\/array-initialization-syntax-when-not-in-a-declaration\"><span style=\"font-weight: 400;\">needs to be initialized<\/span><\/a><span style=\"font-weight: 400;\"> with the desired length.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The following code is acceptable:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">AClass[] array = {object1<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">object2}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0As is:<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AClass[] array = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">AClass[<\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\u2026<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0array[<\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">] = object1<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">array[<\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">] = object2<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">But not:<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AClass[] array<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\u2026<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0array = {object1<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">object2}<\/span><span style=\"font-weight: 400;\">;<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/2403477\/array-variable-initialization-error-in-java\"><span style=\"font-weight: 400;\">how to initialize arrays in Java software<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Runtime Exceptions<\/span><\/h2>\n<h3><b>21. \u201cArrayIndexOutOfBoundsException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This is a runtime error message that occurs when the code attempts to access an array index that is not within the values. <\/span><span style=\"font-weight: 400;\">The <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/5554734\/what-causes-a-java-lang-arrayindexoutofboundsexception-and-how-do-i-prevent-it\"><span style=\"font-weight: 400;\">following code<\/span><\/a><span style=\"font-weight: 400;\"> would<\/span><span style=\"font-weight: 400;\"> trigger this exception:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">String[] name = {\u201ctom\u201d<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\u201cdick\u201d<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\u201charry\u201d}<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">i = <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">; <\/span><span style=\"font-weight: 400;\">i&lt;=name.length<\/span><span style=\"font-weight: 400;\">; <\/span><span style=\"font-weight: 400;\">i++) {<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.print(name[i] +\u2018\\n\u2019)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Here\u2019s another example (@DukeU):<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int<\/span><span style=\"font-weight: 400;\">[] list = <\/span><span style=\"font-weight: 400;\">new int<\/span><span style=\"font-weight: 400;\">[<\/span><span style=\"font-weight: 400;\">5<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">list[<\/span><span style=\"font-weight: 400;\">5<\/span><span style=\"font-weight: 400;\">] = <\/span><span style=\"font-weight: 400;\">33<\/span><span style=\"font-weight: 400;\">; \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\/\/ illegal index, maximum index is 4<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Array indexes start at zero and end at one less than the length of the array. Often it is fixed by using \u201c&lt;\u201d instead of \u201c&lt;=\u201d when defining the limits of the array index.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Check out this example on <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/42654273\/issue-with-arrayindexoutofrange\"><span style=\"font-weight: 400;\">how an index triggered the \u201cArrayIndexOutOfBoundsException\u201d Java software error message<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>22.\u00a0 \u201cStringIndexOutOfBoundsException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This is an issue that occurs when the code attempts to access a part of the string that is not within the bounds of the string. Usually, this happens when the code tries to create a substring of a string that is not of the same length as the parameter. <\/span><span style=\"font-weight: 400;\">Here\u2019s <\/span><a href=\"https:\/\/examples.javacodegeeks.com\/java-basics\/exceptions\/java-lang-stringindexoutofboundsexception-how-to-solve-stringindexoutofboundsexception\/\"><span style=\"font-weight: 400;\">an example<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/javacodegeeks\"><span style=\"font-weight: 400;\">@javacodegeeks<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">StringCharAtExample {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String[] args) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String str = \u201cJava Code Geeks!\u201d<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.println(\u201cLength: \u201c + str.length())<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\/\/The following statement throws an exception, because<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/the request index is invalid.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">char <\/span><span style=\"font-weight: 400;\">ch = str.charAt(<\/span><span style=\"font-weight: 400;\">50<\/span><span style=\"font-weight: 400;\">)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Like array indexes, string indexes start at zero. When indexing a string, the last character is at one less than the length of the string. The \u201cStringIndexOutOfBoundsException\u201d Java software error message usually means the index is trying to access characters that aren\u2019t there.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here\u2019s an example that illustrates <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/19670369\/java-stringindexoutofboundsexception\"><span style=\"font-weight: 400;\">how the \u201cStringIndexOutOfBoundsException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> can occur and be fixed. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>23. \u201cNullPointerException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A \u201cNullPointerException\u201d will occur when the program tries to use an object reference that <\/span><a href=\"http:\/\/www.geeksforgeeks.org\/null-pointer-exception-in-java\/\"><span style=\"font-weight: 400;\">does not have a value assigned<\/span><\/a><span style=\"font-weight: 400;\"> to it (<\/span><a href=\"https:\/\/twitter.com\/geeksforgeeks\"><span style=\"font-weight: 400;\">@geeksforgeeks<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">\/\/ A Java program to demonstrate that invoking a method<\/span>\n\n<span style=\"font-weight: 400;\">\/\/ on null causes NullPointerException<\/span>\n\n<span style=\"font-weight: 400;\">import <\/span><span style=\"font-weight: 400;\">java.io.*<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">GFG<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main <\/span><span style=\"font-weight: 400;\">(String[] args)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\/\/ Initializing String variable with null value<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">String ptr = <\/span><span style=\"font-weight: 400;\">null;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\/\/ Checking if ptr.equals null or works fine.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">try<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\/\/ This line of code throws NullPointerException<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ because ptr is null<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if <\/span><span style=\"font-weight: 400;\">(ptr.equals(\u201cgfg\u201d))<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.print(\u201cSame\u201d)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0else<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.print(\u201cNot Same\u201d)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">catch<\/span><span style=\"font-weight: 400;\">(NullPointerException e)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.print(\u201cNullPointerException Caught\u201d)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The Java program often raises an exception when:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A statement references an object with a null value.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Trying to access a class that is defined but isn\u2019t assigned a reference.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Here\u2019s a discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/218384\/what-is-a-nullpointerexception-and-how-do-i-fix-it\"><span style=\"font-weight: 400;\">when developers encounter the \u201cNullPointerException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error and how to handle it. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>24. \u201cNoClassDefFoundError\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cNoClassDefFoundError\u201d will occur when the interpreter cannot find the file containing a class with the main method. Here\u2019s an example from <\/span><a href=\"https:\/\/dzone.com\/articles\/java-classnotfoundexception-vs-noclassdeffounderro\"><span style=\"font-weight: 400;\">DZone<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/DZone\"><span style=\"font-weight: 400;\">@DZone<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you compile this program:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">A<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\/\/ some code<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">B<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String[] args)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0A a = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">A()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Two .class files are generated: A.class and B.class. Removing the A.class file and running the B.class file, will\u00a0 get you the \u201cNoClassDefFoundError\u201d:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.lang.NoClassDefFoundError: A<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at MainClass.main(MainClass.java:<\/span><span style=\"font-weight: 400;\">10<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Caused by: java.lang.ClassNotFoundException: A<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.findClass(URLClassLoader.java:<\/span><span style=\"font-weight: 400;\">381<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(ClassLoader.java:<\/span><span style=\"font-weight: 400;\">424<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:<\/span><span style=\"font-weight: 400;\">331<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(ClassLoader.java:<\/span><span style=\"font-weight: 400;\">357<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This can happen if:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The file is not in the right directory.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The name of the class is not the same as the name of the file (without the file extension). Also, the names are case sensitive.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/34413\/why-am-i-getting-a-noclassdeffounderror-in-java\"><span style=\"font-weight: 400;\">why \u201cNoClassDefFoundError\u201d occurs when running Java software<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>25. \u201cNoSuchMethodFoundError\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This error message will occur when the Java software tries to call a method of a class and the method no longer has a definition (<\/span><a href=\"https:\/\/twitter.com\/myUND\"><span style=\"font-weight: 400;\">@myUND<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Error: Could not find or load main class wiki.java<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Often the \u201cNoSuchMethodFoundError\u201d Java software error occurs when there is a typo in the declaration.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this tutorial to learn <\/span><a href=\"https:\/\/examples.javacodegeeks.com\/java-basics\/java-lang-nosuchmethoderror-how-to-avoid\/\"><span style=\"font-weight: 400;\">how to avoid the error message \u201cNoSuchMethodFoundError<\/span><\/a><span style=\"font-weight: 400;\">\u201d. (<\/span><a href=\"https:\/\/twitter.com\/javacodegeeks\"><span style=\"font-weight: 400;\">@javacodegeeks<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>26. \u201cNoSuchProviderException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u201cNoSuchProviderException\u201d occurs when a security provider is requested that is <\/span><a href=\"http:\/\/alvinalexander.com\/blog\/post\/java\/java-javax-mail-nosuchproviderexception-solved\"><span style=\"font-weight: 400;\">not available<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/alvinalexander\"><span style=\"font-weight: 400;\">@alvinalexander<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">javax.mail.NoSuchProviderException<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When trying to find why \u201cNoSuchProviderException\u201d occurs, check:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The JRE configuration.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Java_home is set in the configuration.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Java environment being used.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The security provider entry.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/3711754\/why-java-security-nosuchproviderexception-no-such-provider-bc\"><span style=\"font-weight: 400;\">what causes \u201cNoSuchProviderException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> when you run Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>27. AccessControlException<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u201cAccessControlException\u201d indicates that requested access to system resources such as a file system or network is denied, as in this example from <\/span><a href=\"https:\/\/developer.jboss.org\/thread\/274429\"><span style=\"font-weight: 400;\">JBossDeveloper<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/jbossdeveloper\"><span style=\"font-weight: 400;\">@jbossdeveloper<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">ERROR Could not register mbeans java.security.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AccessControlException: WFSM000001: Permission check failed (permission \u201c(\u201cjavax.management.MBeanPermission\u201d \u201corg.apache.logging.log4j.core.jmx.LoggerContextAdmin#-<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[org.apache.logging.log4j2:type=<\/span><span style=\"font-weight: 400;\">51634f<\/span><span style=\"font-weight: 400;\">]\u201d \u201cregisterMBean\u201c)\u201d in code source \u201c(vfs:\/C:\/wildfly-<\/span><span style=\"font-weight: 400;\">10.0.0<\/span><span style=\"font-weight: 400;\">.Final\/standalone\/deployments\/mySampleSecurityApp.war\/WEB-INF\/lib\/log4j-core-<\/span><span style=\"font-weight: 400;\">2.5<\/span><span style=\"font-weight: 400;\">.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jar )\u201d of \u201c<\/span><span style=\"font-weight: 400;\">null<\/span><span style=\"font-weight: 400;\">\u201d)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Read this discussion of a <\/span><a href=\"https:\/\/github.com\/junit-team\/junit4\/issues\/1213\"><span style=\"font-weight: 400;\">workaround used to get past an \u201cAccessControlException\u201d error.<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/github\"><span style=\"font-weight: 400;\">@github<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>28. \u201cArrayStoreException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">An \u201cArrayStoreException\u201d occurs <\/span><a href=\"http:\/\/mindprod.com\/jgloss\/array.html#ARRAYSTOREEXCEPTION\"><span style=\"font-weight: 400;\">when the rules of casting elements in Java arrays<\/span><\/a><span style=\"font-weight: 400;\"> are broken. Be very careful about what values you place inside an array. (<\/span><a href=\"https:\/\/twitter.com\/Roedyg\"><span style=\"font-weight: 400;\">@Roedyg<\/span><\/a><span style=\"font-weight: 400;\">) For instance, this example from <\/span><a href=\"https:\/\/www.javascan.com\/306\/arraystoreexception-in-java-example\"><span style=\"font-weight: 400;\">JavaScan.com<\/span><\/a><span style=\"font-weight: 400;\"> illustrates that this program (<\/span><a href=\"https:\/\/twitter.com\/java_scan\"><span style=\"font-weight: 400;\">@java_scan<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">\/* \u2026\u2026\u2026\u2026\u2026 START \u2026\u2026\u2026\u2026\u2026 *\/<\/span>\n\n<span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">JavaArrayStoreException {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String\u2026 args) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Object[] val = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">Integer[<\/span><span style=\"font-weight: 400;\">4<\/span><span style=\"font-weight: 400;\">]<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">val[<\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">] = <\/span><span style=\"font-weight: 400;\">5.8<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\/* \u2026\u2026\u2026\u2026\u2026 END \u2026\u2026\u2026\u2026\u2026 *\/<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Results in the following output:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.lang.ArrayStoreException: java.lang.Double<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at ExceptionHandling.JavaArrayStoreException.main(JavaArrayStoreException.java:<\/span><span style=\"font-weight: 400;\">7<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">When an array is initialized, the sorts of objects allowed into the array need to be declared. Then each array element needs to be of the same type of object.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/12369957\/dealing-with-an-arraystoreexception\"><span style=\"font-weight: 400;\">how to solve for the \u201cArrayStoreException\u201d.<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>29. \u201cbad magic number\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message means something may be wrong with the class definition files on the network. Here\u2019s an example from <\/span><a href=\"http:\/\/www.theserverside.com\/news\/thread.tss?thread_id=33274\"><span style=\"font-weight: 400;\">The Server Side<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/TSS_dotcom\"><span style=\"font-weight: 400;\">@TSS_dotcom<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Java(TM) Plug\u2013in: Version <\/span><span style=\"font-weight: 400;\">1.3.1_01<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">Using JRE version <\/span><span style=\"font-weight: 400;\">1.3.1_01 <\/span><span style=\"font-weight: 400;\">Java HotSpot(TM) Client VM<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0User home directory = C:\\Documents and Settings\\Ankur<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Proxy Configuration: Manual Configuration<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Proxy: <\/span><span style=\"font-weight: 400;\">192.168.11.6<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">80<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">java.lang.ClassFormatError: SalesCalculatorAppletBeanInfo (Bad magic number)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.defineClass0(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.SecureClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.applet.AppletClassLoader.findClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.security.PluginClassLoader.access$201(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.security.PluginClassLoader$1.run(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.AccessController.doPrivileged(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.applet.AppletClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.beans.Introspector.instantiate(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.beans.Introspector.findInformant(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.beans.Introspector.(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.beans.Introspector.getBeanInfo(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.beans.ole.OleBeanInfo.(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.beans.ole.StubInformation.getStub(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.ocx.TypeLibManager$1.run(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.AccessController.doPrivileged(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.ocx.TypeLibManager.getTypeLib(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.ocx.TypeLibManager.getTypeLib(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.ocx.ActiveXAppletViewer.statusNotification(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.ocx.ActiveXAppletViewer.notifyStatus(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.plugin.ocx.ActiveXAppletViewer.showAppletStatus(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.applet.AppletPanel.run(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.Thread.run(Unknown Source)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The \u201cbad magic number\u201d error message happens when:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The first four bytes of a class file is not the hexadecimal number CAFEBABE.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The class file was uploaded as in ASCII mode, not binary mode.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The java program is run before it is compiled.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/coderanch.com\/t\/407789\/java\/java-bad-magic-number-error\"><span style=\"font-weight: 400;\">how to find the reason for a \u201cbad magic number\u201d.<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/coderanch\"><span style=\"font-weight: 400;\">@coderanch<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>30. \u201cbroken pipe\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This <\/span><a href=\"https:\/\/www.experts-exchange.com\/questions\/23307716\/Exception-in-thread-main-java-net-SocketException-Broken-pipe.html\"><span style=\"font-weight: 400;\">error message<\/span><\/a><span style=\"font-weight: 400;\"> refers to the data stream from a file or network socket that has stopped working or is closed from the other end (<\/span><a href=\"https:\/\/twitter.com\/ExpertsExchange\"><span style=\"font-weight: 400;\">@ExpertsExchange<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.net.SocketException: Broken pipe<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.SocketOutputStream.socketWrite0(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:<\/span><span style=\"font-weight: 400;\">92<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.SocketOutputStream.write(SocketOutputStream.java:<\/span><span style=\"font-weight: 400;\">115<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.io.DataOutputStream.write<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The causes of a \u201cbroken pipe\u201d error often include:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Running out of disk scratch space.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0RAM may be clogged.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The data stream may be corrupt.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The process of reading the pipe might have been closed.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/3751661\/what-is-the-meaning-of-broken-pipe-exception\"><span style=\"font-weight: 400;\">what is the Java error \u201cbroken pipe\u201d<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>31. \u201ccould not create Java Virtual Machine\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java <\/span><a href=\"https:\/\/www.ghacks.net\/2014\/05\/22\/fix-error-create-java-virtual-machine-windows\/\"><span style=\"font-weight: 400;\">error message<\/span><\/a><span style=\"font-weight: 400;\"> usually occurs when the code tries to invoke Java with the wrong arguments (@ghacksnews):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Error: Could not create the Java Virtual Machine<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Error: A fatal exception has occurred. Program will exit.<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">It often is caused by a mistake in the declaration in the code or allocating the proper amount of memory to it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/25609405\/error-could-not-create-the-java-virtual-machine-mac-osx-mavericks\"><span style=\"font-weight: 400;\">how to fix the Java software error \u201cCould not create Java Virtual Machine\u201d<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>32. \u201cclass file contains wrong class\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cclass file contains wrong class\u201d issue occurs when the Java code tries to find the class file in the wrong directory, resulting in an error message similar to the following:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">MyTest.java:<\/span><span style=\"font-weight: 400;\">10<\/span><span style=\"font-weight: 400;\">: cannot access MyStruct<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bad <\/span><span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">file: D:\\Java\\test\\MyStruct.java<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0file does not contain <\/span><span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">MyStruct<\/span>\n\n<span style=\"font-weight: 400;\">Please remove or make sure it appears in the correct subdirectory of the classpath.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MyStruct ms = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">MyStruct()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">^<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">To fix this error, these tips should help:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Make sure the name of the source file and the name of the class match \u2014 including the text case.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Check if the package statement is correct or missing.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Make sure the source file is in the right directory.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/8377239\/java-class-file-contains-wrong-class-error\"><span style=\"font-weight: 400;\">how to fix a \u201cclass file contains wrong class\u201d<\/span><\/a><span style=\"font-weight: 400;\"> error. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>33. \u201cClassCastException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cClassCastException\u201d message indicates the Java code is trying to cast an object to the wrong class. Here is an example from Java Concept of the Day:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">package <\/span><span style=\"font-weight: 400;\">com<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">A<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">i <\/span><span style=\"font-weight: 400;\">= <\/span><span style=\"font-weight: 400;\">10<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">B <\/span><span style=\"font-weight: 400;\">extends <\/span><span style=\"font-weight: 400;\">A<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">j <\/span><span style=\"font-weight: 400;\">= <\/span><span style=\"font-weight: 400;\">20<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">C <\/span><span style=\"font-weight: 400;\">extends <\/span><span style=\"font-weight: 400;\">B<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">k <\/span><span style=\"font-weight: 400;\">= <\/span><span style=\"font-weight: 400;\">30<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">ClassCastExceptionDemo<\/span>\n\n<span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String[] args)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0A a = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">B()<\/span><span style=\"font-weight: 400;\">; \u00a0 <\/span><span style=\"font-weight: 400;\">\/\/B type is auto up casted to A type<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">B b = (B) a<\/span><span style=\"font-weight: 400;\">; <\/span><span style=\"font-weight: 400;\">\/\/A type is explicitly down casted to B type.<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">C c = (C) b<\/span><span style=\"font-weight: 400;\">;\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\/\/Here, you will get class cast exception<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.println(c.<\/span><span style=\"font-weight: 400;\">k<\/span><span style=\"font-weight: 400;\">)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Results in this error:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.lang.ClassCastException: com.B cannot be cast to com.C<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.ClassCastExceptionDemo.main(ClassCastExceptionDemo.java:<\/span><span style=\"font-weight: 400;\">23<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The Java code will create a hierarchy of classes and subclasses. To avoid the \u201cClassCastException\u201d error, make sure the new type belongs to the right class or one of its parent classes. If Generics are used, these errors can be caught when the code is compiled.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this tutorial on <\/span><a href=\"http:\/\/javaconceptoftheday.com\/classcastexception-in-java\/\"><span style=\"font-weight: 400;\">how to fix \u201cClassCastException\u201d Java software errors<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/java_concept\"><span style=\"font-weight: 400;\">@java_concept<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>34. \u201cClassFormatError\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The \u201cClassFormatError\u201d message indicates a <\/span><a href=\"https:\/\/www.mkyong.com\/hibernate\/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-or-abstract-in-class-file\/\"><span style=\"font-weight: 400;\">linkage error<\/span><\/a><span style=\"font-weight: 400;\"> and occurs when a class file cannot be read or interpreted as a class file.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not <\/span><span style=\"font-weight: 400;\">native <\/span><span style=\"font-weight: 400;\">or <\/span><span style=\"font-weight: 400;\">abstract <\/span><span style=\"font-weight: 400;\">in <\/span><span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">file javax\/persistence\/GenerationType<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.defineClass1(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.defineClassCond(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.SecureClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.access$000(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader$1.run(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.AccessController.doPrivileged(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.findClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(Unknown Source)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">There are several reasons why a \u201cClassFormatError\u201d can occur:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The class file was uploaded as in ASCII mode not binary mode.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The web server must send class files as binary, not ASCII.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">There could be a classpath error that prevents the code from finding the class file.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">If the class is loaded twice, the second time will throw an exception.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">You\u2019re using an old version of Java runtime.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/10021752\/java-what-causes-classformaterror\"><span style=\"font-weight: 400;\">what causes the \u201cClassFormatError\u201d<\/span><\/a><span style=\"font-weight: 400;\"> in Java. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>35. \u201cClassNotFoundException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u201cClassNotFoundException\u201d only occurs at run time \u2014 meaning a class that was there during compilation is missing at run time. This is a linkage error.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Much like the \u201cNoClassDefFoundError\u201d this issue can occur if:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The file is not in the right directory.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The name of the class is not the same as the name of the file (without the file extension). Also, the names are case-sensitive.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/17408769\/how-do-i-resolve-this-java-class-not-found-exception\"><span style=\"font-weight: 400;\">what causes \u201cClassNotFoundException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> for more cases. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>36. \u201cExceptionInInitializerError\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This <\/span><a href=\"https:\/\/github.com\/square\/leakcanary\/issues\/46\"><span style=\"font-weight: 400;\">Java issue<\/span><\/a><span style=\"font-weight: 400;\"> will occur when something goes wrong with a static initialization (<\/span><a href=\"https:\/\/twitter.com\/github\"><span style=\"font-weight: 400;\">@GitHub<\/span><\/a><span style=\"font-weight: 400;\">). When the Java code later uses the class, the \u201cNoClassDefFoundError\u201d error will occur.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">java.lang.ExceptionInInitializerError<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:<\/span><span style=\"font-weight: 400;\">54<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at org.eclipse.mat.parser.internal.SnapshotFactory.parse(SnapshotFactory.java:<\/span><span style=\"font-weight: 400;\">193<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at org.eclipse.mat.parser.internal.SnapshotFactory.openSnapshot(SnapshotFactory.java:<\/span><span style=\"font-weight: 400;\">106<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.squareup.leakcanary.HeapAnalyzer.openSnapshot(HeapAnalyzer.java:<\/span><span style=\"font-weight: 400;\">134<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.squareup.leakcanary.HeapAnalyzer.checkForLeak(HeapAnalyzer.java:<\/span><span style=\"font-weight: 400;\">87<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.squareup.leakcanary.internal.HeapAnalyzerService.onHandleIntent(HeapAnalyzerService.java:<\/span><span style=\"font-weight: 400;\">56<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:<\/span><span style=\"font-weight: 400;\">65<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at android.os.Handler.dispatchMessage(Handler.java:<\/span><span style=\"font-weight: 400;\">102<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at android.os.Looper.loop(Looper.java:<\/span><span style=\"font-weight: 400;\">145<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at android.os.HandlerThread.run(HandlerThread.java:<\/span><span style=\"font-weight: 400;\">61<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Caused by: java.lang.NullPointerException: in == <\/span><span style=\"font-weight: 400;\">null<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">at java.util.Properties.load(Properties.java:<\/span><span style=\"font-weight: 400;\">246<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at org.eclipse.mat.util.MessageUtil.(MessageUtil.java:<\/span><span style=\"font-weight: 400;\">28<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at org.eclipse.mat.util.MessageUtil.(MessageUtil.java:<\/span><span style=\"font-weight: 400;\">13<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026 <\/span><span style=\"font-weight: 400;\">10 <\/span><span style=\"font-weight: 400;\">more<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">There needs to be more information to fix the error. Using <\/span><i><span style=\"font-weight: 400;\">getCause()<\/span><\/i><span style=\"font-weight: 400;\"> in the code can return the exception that caused the error to be returned.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/3375810\/exception-in-initializer-error\"><span style=\"font-weight: 400;\">how to track down the cause of the \u201cExceptionInInitializerError<\/span><\/a><span style=\"font-weight: 400;\">\u201d. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>37. \u201cIllegalBlockSizeException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">An \u201cIllegalBlockSizeException\u201d will occur during decryption when the length message is not a multiple of 8 bytes. Here\u2019s an example from <\/span><a href=\"http:\/\/www.programcreek.com\/java-api-examples\/index.php?api=javax.crypto.IllegalBlockSizeException\"><span style=\"font-weight: 400;\">ProgramCreek.com<\/span><\/a><span style=\"font-weight: 400;\"> (@ProgramCreek):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">@Override<\/span>\n\n<span style=\"font-weight: 400;\">protected byte<\/span><span style=\"font-weight: 400;\">[] engineWrap(Key key) <\/span><span style=\"font-weight: 400;\">throws <\/span><span style=\"font-weight: 400;\">IllegalBlockSizeException<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">InvalidKeyException {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">try <\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">byte<\/span><span style=\"font-weight: 400;\">[] encoded = key.getEncoded()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return <\/span><span style=\"font-weight: 400;\">engineDoFinal(encoded<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">encoded.length)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">} <\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(BadPaddingException e) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0IllegalBlockSizeException newE = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">IllegalBlockSizeException()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">newE.initCause(e)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw <\/span><span style=\"font-weight: 400;\">newE<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The \u201cIllegalBlockSizeException\u201d could be caused by:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Using different encryption and decryption algorithm options.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Truncating or garbling the decrypted message during transmission.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/16192140\/cipher-what-is-the-reason-for-illegalblocksizeexception\"><span style=\"font-weight: 400;\">how to prevent the \u201cIllegalBlockSizeException<\/span><\/a><span style=\"font-weight: 400;\">\u201d Java software error message. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>38. \u201cBadPaddingException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A \u201cBadPaddingException\u201d will occur during decryption when padding was used to create a message that can be measured by a multiple of 8 bytes. Here\u2019s an example from <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/4580982\/javax-crypto-badpaddingexception\"><span style=\"font-weight: 400;\">Stack Overflow<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">javax.crypto.BadPaddingException: Given <\/span><span style=\"font-weight: 400;\">final <\/span><span style=\"font-weight: 400;\">block not properly padded<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at javax.crypto.Cipher.doFinal(DashoA13*..)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Encrypted data is binary so don\u2019t try to store it in a string or the data will not be padded properly during encryption.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/31944374\/badpaddingexception-decryption-error\"><span style=\"font-weight: 400;\">how to prevent the \u201cBadPaddingException<\/span><\/a><span style=\"font-weight: 400;\">\u201d. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>39. \u201cIncompatibleClassChangeError\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">An \u201cIncompatibleClassChangeError\u201d is a form of LinkageError that can occur when a base class changes after the compilation of a child class. This example is from <\/span><a href=\"http:\/\/howtodoinjava.com\/core-java\/reflection\/solved-java-lang-incompatibleclasschangeerror-implementing-class\/\"><span style=\"font-weight: 400;\">How to Do in Java<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/HowToDoInJava\"><span style=\"font-weight: 400;\">@HowToDoInJava<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.lang.IncompatibleClassChangeError: Implementing class<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">at java.lang.ClassLoader.defineClass1(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.SecureClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.defineClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.access$000(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader$1.run(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.security.AccessController.doPrivileged(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.net.URLClassLoader.findClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClass(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.ClassLoader.loadClassInternal(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.DebuggingClassWriter.toByteArray(DebuggingClassWriter.java:<\/span><span style=\"font-weight: 400;\">73<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:<\/span><span style=\"font-weight: 400;\">26<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:<\/span><span style=\"font-weight: 400;\">216<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:<\/span><span style=\"font-weight: 400;\">144<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:<\/span><span style=\"font-weight: 400;\">116<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:<\/span><span style=\"font-weight: 400;\">108<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:<\/span><span style=\"font-weight: 400;\">104<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at net.sf.cglib.proxy.Enhancer.(Enhancer.java:<\/span><span style=\"font-weight: 400;\">69<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">When the \u201cIncompatibleClassChangeError\u201d occurs, it is possible that:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The static on the main method was forgotten.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A legal class was used illegally.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A class was changed and there are references to it from another class by its old signatures.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Try deleting all class files and recompiling everything, or try these <\/span><a href=\"https:\/\/examples.javacodegeeks.com\/java-basics\/exceptions\/java-lang-incompatibleclasschangeerror-how-to-resolve-incompatible-class-change-error\/\"><span style=\"font-weight: 400;\">steps to resolve the \u201cIncompatibleClassChangeError\u201d<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/javacodegeeks\"><span style=\"font-weight: 400;\">@javacodegeeks<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>40. \u201cFileNotFoundException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software <\/span><a href=\"http:\/\/www.javased.com\/?api=java.io.FileNotFoundException\"><span style=\"font-weight: 400;\">error message<\/span><\/a><span style=\"font-weight: 400;\"> is thrown when a file with the specified pathname does not exist.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">@Override <\/span><span style=\"font-weight: 400;\">public <\/span><span style=\"font-weight: 400;\">ParcelFileDescriptor openFile(Uri uri<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">String mode) <\/span><span style=\"font-weight: 400;\">throws <\/span><span style=\"font-weight: 400;\">FileNotFoundException {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if <\/span><span style=\"font-weight: 400;\">(uri.toString().startsWith(FILE_PROVIDER_PREFIX)) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">m=ParcelFileDescriptor.MODE_READ_ONLY<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if <\/span><span style=\"font-weight: 400;\">(mode.equalsIgnoreCase(\u201crw\u201d)) m=ParcelFileDescriptor.MODE_READ_WRITE<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">File f=<\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">File(uri.getPath())<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">ParcelFileDescriptor pfd=ParcelFileDescriptor.<\/span><span style=\"font-weight: 400;\">open<\/span><span style=\"font-weight: 400;\">(f<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">m)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return <\/span><span style=\"font-weight: 400;\">pfd<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">else <\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">throw new <\/span><span style=\"font-weight: 400;\">FileNotFoundException(\u201cUnsupported uri: \u201c + uri.toString())<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n\n\n<\/pre>\n<p><span style=\"font-weight: 400;\">In addition to files not exhibiting the specified pathname, this could mean the existing file is inaccessible.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/19307622\/java-new-file-says-filenotfoundexception-but-file-exists\"><span style=\"font-weight: 400;\">why the \u201cFileNotFoundException\u201d could be thrown<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>41. \u201cEOFException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">An \u201cEOFException\u201d is thrown when an end of file or end of the stream has been reached unexpectedly during input. Here\u2019s an example from JavaBeat of an application that throws an EOFException:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import <\/span><span style=\"font-weight: 400;\">java.io.DataInputStream<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">import <\/span><span style=\"font-weight: 400;\">java.io.EOFException<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">import <\/span><span style=\"font-weight: 400;\">java.io.File<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">import <\/span><span style=\"font-weight: 400;\">java.io.FileInputStream<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">import <\/span><span style=\"font-weight: 400;\">java.io.IOException<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">ExceptionExample {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public void <\/span><span style=\"font-weight: 400;\">testMethod1<\/span><span style=\"font-weight: 400;\">(){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0File file = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">File(\u201ctest.txt\u201d)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">DataInputStream dataInputStream =\u00a0 <\/span><span style=\"font-weight: 400;\">null;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try<\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0dataInputStream = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">DataInputStream(<\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">FileInputStream(file))<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">true<\/span><span style=\"font-weight: 400;\">){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0dataInputStream.readInt()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(EOFException e){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e.printStackTrace()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(IOException e){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e.printStackTrace()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">finally<\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">try<\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if <\/span><span style=\"font-weight: 400;\">(dataInputStream != <\/span><span style=\"font-weight: 400;\">null<\/span><span style=\"font-weight: 400;\">){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0dataInputStream.close()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(IOException e){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0e.printStackTrace()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String[] args){<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ExceptionExample instance1 = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">ExceptionExample()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">instance1.testMethod1()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Running the program above results in the following exception:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">java.io.EOFException<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.io.DataInputStream.readInt(DataInputStream.java:<\/span><span style=\"font-weight: 400;\">392<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at logging.simple.ExceptionExample.testMethod1(ExceptionExample.java:<\/span><span style=\"font-weight: 400;\">16<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at logging.simple.ExceptionExample.main(ExceptionExample.java:<\/span><span style=\"font-weight: 400;\">36<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">When there is no more data while the class \u201cDataInputStream\u201d is trying to read data in the stream, \u201cEOFException\u201d will be thrown. It can also occur in the \u201cObjectInputStream\u201d and \u201cRandomAccessFile\u201d classes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/664331\/when-will-an-eofexception-occur-in-javas-streams\"><span style=\"font-weight: 400;\">when the \u201cEOFException\u201d can occur while running Java software<\/span><\/a><span style=\"font-weight: 400;\">. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>42. \u201cUnsupportedEncodingException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message is thrown when the <\/span><span style=\"font-weight: 400;\">character encoding is not supported<\/span><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/Penn\"><span style=\"font-weight: 400;\">@Penn<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public <\/span><span style=\"font-weight: 400;\">UnsupportedEncodingException()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">It is possible that the Java Virtual Machine being used doesn\u2019t support a given character set.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/10748440\/recommended-method-for-handling-unsupportedencodingexception-from-string-getbyte\"><span style=\"font-weight: 400;\">how to handle \u201cUnsupportedEncodingException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> while running Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>43. \u201cSocketException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A \u201cSocketException\u201d message indicates there is an <\/span><a href=\"http:\/\/www.programcreek.com\/java-api-examples\/java.net.SocketException\"><span style=\"font-weight: 400;\">error creating or accessing a socket<\/span><\/a><span style=\"font-weight: 400;\"> (@ProgramCreek).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public void <\/span><span style=\"font-weight: 400;\">init(String contextName<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">ContextFactory factory) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">super<\/span><span style=\"font-weight: 400;\">.init(contextName<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">factory)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">String periodStr = getAttribute(PERIOD_PROPERTY)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if <\/span><span style=\"font-weight: 400;\">(periodStr != <\/span><span style=\"font-weight: 400;\">null<\/span><span style=\"font-weight: 400;\">) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">period = <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try <\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0period = Integer.parseInt(periodStr)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">} <\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(NumberFormatException nfe) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if <\/span><span style=\"font-weight: 400;\">(period &lt;= <\/span><span style=\"font-weight: 400;\">0<\/span><span style=\"font-weight: 400;\">) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">throw new <\/span><span style=\"font-weight: 400;\">MetricsException(\u201cInvalid period: \u201c + periodStr)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0setPeriod(period)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0metricsServers =<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Util.parse(getAttribute(SERVERS_PROPERTY)<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">DEFAULT_PORT)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">unitsTable = getAttributeTable(UNITS_PROPERTY)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">slopeTable = getAttributeTable(SLOPE_PROPERTY)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">tmaxTable\u00a0 = getAttributeTable(TMAX_PROPERTY)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">dmaxTable\u00a0 = getAttributeTable(DMAX_PROPERTY)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n\n\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try <\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0datagramSocket = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">DatagramSocket()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(SocketException se) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0se.printStackTrace()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This exception usually is thrown when the maximum connections are reached due to:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No more network ports available to the application.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The system doesn\u2019t have enough memory to support new connections.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/585599\/whats-causing-my-java-net-socketexception-connection-reset\"><span style=\"font-weight: 400;\">how to resolve \u201cSocketException\u201d issues<\/span><\/a><span style=\"font-weight: 400;\"> while running Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>44. \u201cSSLException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message occurs when there is failure in SSL-related operations. The following example is from <\/span><a href=\"https:\/\/confluence.atlassian.com\/jirakb\/unable-to-access-ssl-services-due-to-java-security-invalidalgorithmparameterexception-218269293.html\"><span style=\"font-weight: 400;\">Atlassian<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/Atlassian\"><span style=\"font-weight: 400;\">@Atlassian<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">com.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non\u2013empty<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.jersey.client.apache.ApacheHttpClientHandler.handle(ApacheHttpClientHandler.java:<\/span><span style=\"font-weight: 400;\">202<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.jersey.api.client.Client.handle(Client.java:<\/span><span style=\"font-weight: 400;\">365<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.jersey.api.client.WebResource.handle(WebResource.java:<\/span><span style=\"font-weight: 400;\">556<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.sun.jersey.api.client.WebResource.get(WebResource.java:<\/span><span style=\"font-weight: 400;\">178<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.client.service.product.ProductServiceClientImpl.getProductVersionsAfterVersion(ProductServiceClientImpl.java:<\/span><span style=\"font-weight: 400;\">82<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.upm.pac.PacClientImpl.getProductUpgrades(PacClientImpl.java:<\/span><span style=\"font-weight: 400;\">111<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.upm.rest.resources.ProductUpgradesResource.get(ProductUpgradesResource.java:<\/span><span style=\"font-weight: 400;\">39<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.lang.reflect.Method.invoke(Unknown Source)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:<\/span><span style=\"font-weight: 400;\">206<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:<\/span><span style=\"font-weight: 400;\">90<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:<\/span><span style=\"font-weight: 400;\">61<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.expand.interceptor.ExpandInterceptor.intercept(ExpandInterceptor.java:<\/span><span style=\"font-weight: 400;\">38<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:<\/span><span style=\"font-weight: 400;\">61<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.invokeMethodWithInterceptors(DispatchProviderHelper.java:<\/span><span style=\"font-weight: 400;\">98<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.access$100(DispatchProviderHelper.java:<\/span><span style=\"font-weight: 400;\">28<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker._dispatch(DispatchProviderHelper.java:<\/span><span style=\"font-weight: 400;\">202<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non\u2013empty<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non\u2013empty<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non\u2013empty<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This can happen if:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Certificates on the server or client have expired.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A server port has been reset to another port.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/30538640\/javax-net-ssl-sslexception-read-error-ssl-0x9524b800-i-o-error-during-system?lq=1\"><span style=\"font-weight: 400;\">what can cause the \u201cSSLException\u201d error<\/span><\/a><span style=\"font-weight: 400;\"> in Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>45. \u201cMissingResourceException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A \u201cMissingResourceException\u201d occurs when a resource is missing. If the resource is in the correct classpath, this is usually because a properties file is not configured properly. Here\u2019s an <\/span><a href=\"http:\/\/community.jaspersoft.com\/questions\/823206\/javautilmissingresourceexception-cant-find-bundle-base-name-localemsgsenus-locale\"><span style=\"font-weight: 400;\">example<\/span><\/a><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/TIBCO\"><span style=\"font-weight: 400;\">@TIBCO<\/span><\/a><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">java.util.MissingResourceException: Can\u2018t find bundle <\/span><span style=\"font-weight: 400;\">for <\/span><span style=\"font-weight: 400;\">base name localemsgs_en_US<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">locale en_US<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0java.util.ResourceBundle.throwMissingResourceException<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0java.util.ResourceBundle.getBundleImpl<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0java.util.ResourceBundle.getBundle<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/javahowto.blogspot.com\/2006\/05\/debug-java-util-missingresourceexcepti.html\"><span style=\"font-weight: 400;\">how to fix \u201cMissingResourceException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> while running Java software.<\/span><\/p>\n<h3><b>46. \u201cNoInitialContextException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A \u201cNoInitialContextException\u201d error occurs when the Java application wants to perform a naming operation but <\/span><span style=\"font-weight: 400;\">can\u2019t create a connection<\/span><span style=\"font-weight: 400;\"> (<\/span><a href=\"https:\/\/twitter.com\/TheASF\"><span style=\"font-weight: 400;\">@TheASF<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">[java] Caused by: javax.naming.NoInitialContextException: Need to specify <\/span><span style=\"font-weight: 400;\">class <\/span><span style=\"font-weight: 400;\">name in environment or system property<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">or as an applet parameter<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">or in an application resource file:\u00a0 java.naming.factory.initial<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:<\/span><span style=\"font-weight: 400;\">645<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:<\/span><span style=\"font-weight: 400;\">247<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[java] at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:<\/span><span style=\"font-weight: 400;\">284<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[java] at javax.naming.InitialContext.lookup(InitialContext.java:<\/span><span style=\"font-weight: 400;\">351<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[java] at org.apache.camel.impl.JndiRegistry.lookup(JndiRegistry.java:<\/span><span style=\"font-weight: 400;\">51<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This can be a complex problem to solve but here are some possible issues that cause the \u201cNoInitialContextException\u201d Java error message:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The application may not have the proper credentials to make a connection.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The code may not identify the implementation of JNDI needed.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The \u201cInitialContext\u201d class may not be configured with the right properties.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/6387238\/what-does-javax-naming-noinitialcontextexception-mean\"><span style=\"font-weight: 400;\">what \u201cNoInitialContextException\u201d means<\/span><\/a><span style=\"font-weight: 400;\"> when running Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>47. \u201cNoSuchElementException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A \u201cNoSuchElementException\u201d error happens when an iteration (such as a \u201cfor\u201d loop) tries to access the next element when there is none.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">NoSuchElementExceptionDemo{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String args[]) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Hashtable sampleMap = <\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">Hashtable()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">Enumeration enumeration = sampleMap.elements()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">enumeration.nextElement()<\/span><span style=\"font-weight: 400;\">;\u00a0 <\/span><span style=\"font-weight: 400;\">\/\/java.util.NoSuchElementExcepiton here because enumeration is empty<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">Output:<\/span>\n\n<span style=\"font-weight: 400;\">Exception in thread \u201cmain\u201d java.util.NoSuchElementException: Hashtable Enumerator<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at java.util.Hashtable$EmptyEnumerator.nextElement(Hashtable.java:<\/span><span style=\"font-weight: 400;\">1084<\/span><span style=\"font-weight: 400;\">)<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0at test.ExceptionTest.main(NoSuchElementExceptionDemo.java:<\/span><span style=\"font-weight: 400;\">23<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The \u201cNoSuchElementException\u201d can be thrown by these methods:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Enumeration::nextElement()<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">NamingEnumeration::next()<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">StringTokenizer::nextElement()<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Iterator::next()<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this tutorial on <\/span><a href=\"https:\/\/javarevisited.blogspot.com\/2012\/02\/how-to-solve-javautilnosuchelementexcep.html\"><span style=\"font-weight: 400;\">how to fix \u201cNoSuchElementException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> in Java software. (<\/span><a href=\"https:\/\/twitter.com\/javinpaul\"><span style=\"font-weight: 400;\">@javinpaul<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>48. \u201cNoSuchFieldError\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message is thrown when an application tries to access a field in an object but the specified field <\/span><a href=\"http:\/\/ulibgcj.sourceforge.net\/javadoc\/java\/lang\/NoSuchFieldError.html\"><span style=\"font-weight: 400;\">no longer exists<\/span><\/a><span style=\"font-weight: 400;\"> in the object (<\/span><a href=\"https:\/\/twitter.com\/sourceforge\"><span style=\"font-weight: 400;\">@sourceforge<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">public <\/span><span style=\"font-weight: 400;\">NoSuchFieldError()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Usually, this error is caught in the compiler but will be caught during runtime if a class definition has been changed between compiling and running.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Read this discussion of how to find <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/6686753\/nosuchfielderror-java\"><span style=\"font-weight: 400;\">what causes the \u201cNoSuchFieldError\u201d<\/span><\/a><span style=\"font-weight: 400;\"> when running Java software. <\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><\/p>\n<h3><b>49. \u201cNumberFormatException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software <\/span><a href=\"http:\/\/alvinalexander.com\/blog\/post\/java\/java-faq-what-is-numberformatexception\"><span style=\"font-weight: 400;\">error message occurs<\/span><\/a><span style=\"font-weight: 400;\"> when the application tries to convert a string to a numeric type, but that the number is not a valid string of digits (<\/span><a href=\"https:\/\/twitter.com\/alvinalexander\"><span style=\"font-weight: 400;\">@alvinalexander<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">package <\/span><span style=\"font-weight: 400;\">com.devdaily.javasamples<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">public class <\/span><span style=\"font-weight: 400;\">ConvertStringToNumber {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">public static void <\/span><span style=\"font-weight: 400;\">main<\/span><span style=\"font-weight: 400;\">(String[] args) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">try <\/span><span style=\"font-weight: 400;\">{<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String s = \u201cFOOBAR\u201d<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int <\/span><span style=\"font-weight: 400;\">i = Integer.<\/span><i><span style=\"font-weight: 400;\">parseInt<\/span><\/i><span style=\"font-weight: 400;\">(s)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">\/\/ this line of code will never be reached<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">System.<\/span><i><span style=\"font-weight: 400;\">out<\/span><\/i><span style=\"font-weight: 400;\">.println(\u201c<\/span><span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">value = \u201c + i)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">catch <\/span><span style=\"font-weight: 400;\">(NumberFormatException nfe) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0nfe.printStackTrace()<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0}<\/span>\n\n<span style=\"font-weight: 400;\">}<\/span>\n\n\n<\/pre>\n<p><span style=\"font-weight: 400;\">The error \u201cNumberFormatException\u201d is thrown when:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Leading or trailing spaces in the number exist.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The sign is not ahead of the number.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The number has commas.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Localisation may not categorize it as a valid number.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The number is too big to fit in the numeric type.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Read this discussion of <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/5499523\/how-to-avoid-number-format-exception-in-java\"><span style=\"font-weight: 400;\">how to avoid \u201cNumberFormatException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> when running Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<h3><b>50. \u201cTimeoutException\u201d<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This Java software error message occurs when a <\/span><a href=\"http:\/\/www.javased.com\/index.php?api=java.util.concurrent.TimeoutException\"><span style=\"font-weight: 400;\">blocking operation is timed out<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">private void <\/span><span style=\"font-weight: 400;\">queueObject(ComplexDataObject obj) <\/span><span style=\"font-weight: 400;\">throws <\/span><span style=\"font-weight: 400;\">TimeoutException<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">InterruptedException {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">if <\/span><span style=\"font-weight: 400;\">(!queue.offer(obj<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">10<\/span><span style=\"font-weight: 400;\">,<\/span><span style=\"font-weight: 400;\">TimeUnit.SECONDS)) {<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0TimeoutException ex=<\/span><span style=\"font-weight: 400;\">new <\/span><span style=\"font-weight: 400;\">TimeoutException(\u201cTimed out waiting <\/span><span style=\"font-weight: 400;\">for <\/span><span style=\"font-weight: 400;\">parsed elements to be processed. Aborting.\u201d)<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0throw <\/span><span style=\"font-weight: 400;\">ex<\/span><span style=\"font-weight: 400;\">;<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400;\">}<\/span>\n\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Read this discussion about <\/span><a href=\"https:\/\/stackoverflow.com\/questions\/36575470\/how-to-use-fallbackfuture-to-handle-timeoutexception\"><span style=\"font-weight: 400;\">how to handle \u201cTimeoutException\u201d<\/span><\/a><span style=\"font-weight: 400;\"> when running Java software. (<\/span><a href=\"https:\/\/twitter.com\/StackOverflow\"><span style=\"font-weight: 400;\">@StackOverflow<\/span><\/a><span style=\"font-weight: 400;\">)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For the ultimate Java developer\u2019s toolkit, don\u2019t forget to download <\/span><a href=\"https:\/\/info.stackify.com\/buildbetter-2.2-the-comprehensive-java-developers-guide\"><span style=\"font-weight: 400;\">The Comprehensive Java Developer\u2019s Guide<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h2><b>Retrace Error Monitoring<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">The fastest way to fix errors in your software is to properly implement an error monitoring system, such as Retrace.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">With Retrace, you can find hidden errors lying silently in your code. Its powerful and efficient code profiling even tracks the errors you aren\u2019t logging and helps you monitor error spikes and fix them quickly before reaching your users. Not only that, you will know when there are new types of errors discovered within your application because the system will notify you through an email or SMS.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0Also available to help you write error-free code with ease is<\/span> <a href=\"https:\/\/stackify.com\/prefix\/\"><span style=\"font-weight: 400;\">Stackify by Netreo\u2019s free code profiler, Prefix<\/span><\/a><span style=\"font-weight: 400;\">, which supports .NET, Java, PHP, Node.js, Ruby, and Python applications.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For more tips and tricks for coding better Java programs, download our<\/span><a href=\"https:\/\/info.stackify.com\/buildbetter-2.2-the-comprehensive-java-developers-guide?_ga=2.261140109.142966078.1615939463-1219357962.1606953611\"><span style=\"font-weight: 400;\"> Comprehensive Java Developer\u2019s Guide<\/span><\/a><span style=\"font-weight: 400;\">, which is jam-packed with everything you need to up your Java game \u2013 from tools to the best websites and blogs, YouTube channels, Twitter influencers, LinkedIn groups, podcasts, must-attend events, and more.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you\u2019re working with .NET, you should also check out our guide to the<\/span><a href=\"https:\/\/stackify.com\/top-net-software-errors\/\"><span style=\"font-weight: 400;\"> 50 most common .NET software errors<\/span><\/a><span style=\"font-weight: 400;\"> and how to avoid them.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There is no better time than now. Start your 14-day <\/span><a href=\"https:\/\/stackify.com\/pricing\/\"><span style=\"font-weight: 400;\">FREE TRIAL<\/span><\/a><span style=\"font-weight: 400;\"> and experience the advantage of Retrace and Prefix from Stackify by Netreo.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Imagine, you are developing Java software and suddenly you encounter an error? Where could you have possibly gone wrong? There are many types of errors that you will encounter while developing Java software, but most are avoidable. Some errors are minor lapses when writing codes but that is very much mendable. If you have an [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":36742,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7,10],"tags":[52],"class_list":["post-11491","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","category-team","tag-developer-tips"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v25.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java Software Errors: How to Avoid 50 Code Issues in Java<\/title>\n<meta name=\"description\" content=\"We&#039;ve rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common coding problems.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stackify.com\/top-java-software-errors\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Software Errors: How to Avoid 50 Code Issues in Java\" \/>\n<meta property=\"og:description\" content=\"We&#039;ve rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common coding problems.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stackify.com\/top-java-software-errors\/\" \/>\n<meta property=\"og:site_name\" content=\"Stackify\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Stackify\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-28T10:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-05T11:48:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"881\" \/>\n\t<meta property=\"og:image:height\" content=\"441\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Stackify Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@stackify\" \/>\n<meta name=\"twitter:site\" content=\"@stackify\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stackify Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/\"},\"author\":{\"name\":\"Stackify Team\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/person\/17745b16e8a04befc464e9669d6e7e59\"},\"headline\":\"Top Java Software Errors: 50 Common Java Errors and How to Avoid Them\",\"datePublished\":\"2021-05-28T10:00:00+00:00\",\"dateModified\":\"2024-03-05T11:48:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/\"},\"wordCount\":4234,\"publisher\":{\"@id\":\"https:\/\/stackify.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg\",\"keywords\":[\"developer tips\"],\"articleSection\":[\"Developer Tips, Tricks &amp; Resources\",\"Insights for Dev Managers\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/\",\"url\":\"https:\/\/stackify.com\/top-java-software-errors\/\",\"name\":\"Java Software Errors: How to Avoid 50 Code Issues in Java\",\"isPartOf\":{\"@id\":\"https:\/\/stackify.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg\",\"datePublished\":\"2021-05-28T10:00:00+00:00\",\"dateModified\":\"2024-03-05T11:48:14+00:00\",\"description\":\"We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common coding problems.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/stackify.com\/top-java-software-errors\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage\",\"url\":\"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg\",\"contentUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg\",\"width\":881,\"height\":441,\"caption\":\"top java software errors\"},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/stackify.com\/#website\",\"url\":\"https:\/\/stackify.com\/\",\"name\":\"Stackify\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/stackify.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/stackify.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/stackify.com\/#organization\",\"name\":\"Stackify\",\"url\":\"https:\/\/stackify.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png\",\"contentUrl\":\"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png\",\"width\":1377,\"height\":430,\"caption\":\"Stackify\"},\"image\":{\"@id\":\"https:\/\/stackify.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Stackify\/\",\"https:\/\/x.com\/stackify\",\"https:\/\/www.instagram.com\/stackify\/\",\"https:\/\/www.linkedin.com\/company\/2596184\",\"https:\/\/www.youtube.com\/stackify\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/person\/17745b16e8a04befc464e9669d6e7e59\",\"name\":\"Stackify Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stackify.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b3f4b8e5d5b39734bb1b5a6661faa538?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b3f4b8e5d5b39734bb1b5a6661faa538?s=96&d=mm&r=g\",\"caption\":\"Stackify Team\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java Software Errors: How to Avoid 50 Code Issues in Java","description":"We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common coding problems.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/stackify.com\/top-java-software-errors\/","og_locale":"en_US","og_type":"article","og_title":"Java Software Errors: How to Avoid 50 Code Issues in Java","og_description":"We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common coding problems.","og_url":"https:\/\/stackify.com\/top-java-software-errors\/","og_site_name":"Stackify","article_publisher":"https:\/\/www.facebook.com\/Stackify\/","article_published_time":"2021-05-28T10:00:00+00:00","article_modified_time":"2024-03-05T11:48:14+00:00","og_image":[{"width":881,"height":441,"url":"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg","type":"image\/jpeg"}],"author":"Stackify Team","twitter_card":"summary_large_image","twitter_creator":"@stackify","twitter_site":"@stackify","twitter_misc":{"Written by":"Stackify Team","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/stackify.com\/top-java-software-errors\/#article","isPartOf":{"@id":"https:\/\/stackify.com\/top-java-software-errors\/"},"author":{"name":"Stackify Team","@id":"https:\/\/stackify.com\/#\/schema\/person\/17745b16e8a04befc464e9669d6e7e59"},"headline":"Top Java Software Errors: 50 Common Java Errors and How to Avoid Them","datePublished":"2021-05-28T10:00:00+00:00","dateModified":"2024-03-05T11:48:14+00:00","mainEntityOfPage":{"@id":"https:\/\/stackify.com\/top-java-software-errors\/"},"wordCount":4234,"publisher":{"@id":"https:\/\/stackify.com\/#organization"},"image":{"@id":"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage"},"thumbnailUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg","keywords":["developer tips"],"articleSection":["Developer Tips, Tricks &amp; Resources","Insights for Dev Managers"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/stackify.com\/top-java-software-errors\/","url":"https:\/\/stackify.com\/top-java-software-errors\/","name":"Java Software Errors: How to Avoid 50 Code Issues in Java","isPartOf":{"@id":"https:\/\/stackify.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage"},"image":{"@id":"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage"},"thumbnailUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg","datePublished":"2021-05-28T10:00:00+00:00","dateModified":"2024-03-05T11:48:14+00:00","description":"We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common coding problems.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/stackify.com\/top-java-software-errors\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stackify.com\/top-java-software-errors\/#primaryimage","url":"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg","contentUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2021\/05\/top-java-software-errors-881x441-1.jpg","width":881,"height":441,"caption":"top java software errors"},{"@type":"WebSite","@id":"https:\/\/stackify.com\/#website","url":"https:\/\/stackify.com\/","name":"Stackify","description":"","publisher":{"@id":"https:\/\/stackify.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/stackify.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/stackify.com\/#organization","name":"Stackify","url":"https:\/\/stackify.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stackify.com\/#\/schema\/logo\/image\/","url":"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png","contentUrl":"https:\/\/stackify.com\/wp-content\/uploads\/2024\/05\/logo-1.png","width":1377,"height":430,"caption":"Stackify"},"image":{"@id":"https:\/\/stackify.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Stackify\/","https:\/\/x.com\/stackify","https:\/\/www.instagram.com\/stackify\/","https:\/\/www.linkedin.com\/company\/2596184","https:\/\/www.youtube.com\/stackify"]},{"@type":"Person","@id":"https:\/\/stackify.com\/#\/schema\/person\/17745b16e8a04befc464e9669d6e7e59","name":"Stackify Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stackify.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b3f4b8e5d5b39734bb1b5a6661faa538?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b3f4b8e5d5b39734bb1b5a6661faa538?s=96&d=mm&r=g","caption":"Stackify Team"}}]}},"_links":{"self":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts\/11491"}],"collection":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/comments?post=11491"}],"version-history":[{"count":6,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts\/11491\/revisions"}],"predecessor-version":[{"id":43103,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/posts\/11491\/revisions\/43103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/media\/36742"}],"wp:attachment":[{"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/media?parent=11491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/categories?post=11491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stackify.com\/wp-json\/wp\/v2\/tags?post=11491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}