Java compile error: “reached end of file while parsing }”

I have the following source code public class mod_MyMod extends BaseMod public String Version() { return “1.2_02”; } public void AddRecipes(CraftingManager recipes) { recipes.addRecipe(new ItemStack(Item.diamond), new Object[] { “#”, Character.valueOf(‘#’), Block.dirt }); } When I try to compile it I get the following error: java:11: reached end of file while parsing } What am I … Read more

Else without if

you have an else statement after a for loop for(int i=3;i*i<=n;i+=2) { if(n%1==0) { System.out.println(“Your number isn’t prime.”); } } else { System.out.println(“Your number is prime!”); } you probably have to make a Boolean variable to do this one. there are various ways to do it, but here’s one that I would probably use boolean isPrime = true; for(int … Read more

Error: Could not find or load main class in intelliJ IDE

This might help: 1) “Build” menu -> “Rebuild Project“. Sometimes Intellij doesn’t rewrite the classes because they already exist, this way you ask Intellij to rewrite everything. 2) “Run” menu -> “Edit configuration” -> delete the profile -> add back the profile (“Application” if it’s a Java application), choose your main class from the “Main … Read more

Java error: void cannot be converted to String

Your function has no return value void and you try to assign it to a string variable, that is what the error message means. So change: public static void encrypt(String original) throws Exception { to public static String encrypt(String original) throws Exception { and So the class looks like: class MD5Digest { public static String … Read more