Before i create a package name to my class i done my work correctly. i faced problem like ** Could not find or load main class** after giving a package name to my class will you please check my below code
package c2.get.pack;
import java.util.*;
import java.lang.*;
class FindDiff
{
public static void main(String[] args)
{
ArrayList<Integer> arr=new ArrayList<Integer>();
arr.add(1);
arr.add(2);
arr.add(5);
arr.add(5);
arr.add(7);
arr.add(7);
arr.add(11);
System.out.println("Prime number in ArrayList :"+arr);
Set<Integer> set=new HashSet<Integer>(arr);
arr.clear();
arr.addAll(set);
System.out.println("Prime number in Set :"+arr);
Iterator itr=set.iterator();
while(itr.hasNext()){
int num=(int)itr.next();
System.out.println(num);
}
}
i got an error result like this
first i compile the file with class name like
G:\java\java_programs\logics>javac FindDiff.java
after that had try to run the program with package name i give an error
G:\java\java_programs\logics>java c2.get.pack.FindDiff
Error: Could not find or load main class c2.get.pack.FindDiff
What the error here from my side.Please note that i used notepad to write a program.After compiling the program it's not create any package