Posts

Showing posts from May, 2016

Error: Could not find or load main class TestEnum | Java

Image
/** * @author Shashank Shekhar * @version 1.0 * This program test enum under if condition */ package Chapter3; public class TestEnum { enum Season {spring, summer, fall, winter}; public static void main(String[] args) { Season W1 = Season.summer; if(W1.equals(Season.winter)) { System.out.println("Well....Weather is Winter..."); } else { System.out.println("Well....Weather is Not Winter..."); } } } Generally what happen when we compile a normal java program without any package (or namespace in C#) is that ".class" is generated in place where ".Java" files is placed. So, executing below command will generate TestEnum.class in folder where TestEnum.java is located. D:\Temp\javac TestEnum.java But problem starts once you have put or create any namespace/package in ".java" file. So executing below command results in given error even if everything is correct. D:\Temp\java Chapter3.TestEnum ...