java code writing pitfalls:
Common error:
Console error: Can not find or load the main class HelloWorld reasons: java.lang.NoClassDefFoundError: cn / itcast / day01 / demo01 / HelloWorld (wrong name: Helloworld)
Analysis: This is a novice common pitfalls: the package name or class name with the actual match.
E.g:
package cn.itcast.day01.demo01; public class HelloWorld { public static void main(String[] args) { System.out.println("你好!"); int[] b=new int[4]; System.out.println(b[1]); } }
The above code is no problem, but if you folder (the package name) or file name (eg HelloWorld here) do not correspond, it will make such a mistake in running times.