Following me everywhere? why do I get those exceptions very much??? why are they raised?? My classes are always in the same package as the class they accesses them.. I know they are there. Why doesn't the compiler find them????

thanks for your help ppl...please help :@

Recommended Answers

All 4 Replies

Following me everywhere? why do I get those exceptions very much??? why are they raised?? My classes are always in the same package as the class they accesses them.. I know they are there. Why doesn't the compiler find them????

thanks for your help ppl...please help :@

don't know, you're not giving us much to go on ..
sure you used the right names and they're all compiled?

public class LinkedListQueue {

	Node node = new Node(); // the top
	private int size;
	private int countSize = 0;

	public LinkedListQueue(int i) {
		this.size = i;
	}

	public void destroy() {
		while (node.getNextNode() != null)
			node.setNextNode(null);
		countSize = 0;
	}

	public void add(int o) {
		if (node == null) {

				node = new Node(o);
			countSize++;
		} else {
			if (countSize < size) {
				Node temp = node;
				while (temp.getNextNode() != null) {
					temp = temp.getNextNode();
				}
				temp.setNextNode(new Node(o));
				countSize++;
			} else
				System.out.println("QUEUE FULL");
		}

	}

	public void remove() {
		countSize--;
		node = node.getNextNode();
	}

	public boolean isEmpty() {
		return node == null;
	}

	public boolean isFull() {
		return countSize == size;
	}

	public void printQueue() {
		while (node.getNextNode() != null)
			System.out.println(node);
	}

	public int size() {
		return countSize;
	}

}



public class Node {
	private int dataItem;
	private Node nextNode = null;

	public Node(){
		
	}
	public Node(int data){
		this.dataItem = data;
		this.setNextNode(null);
		
	}
	public int getDataItem() {
		return dataItem;
	}

	public void setDataItem(int dataItem) {
		this.dataItem = dataItem;
	}

	public Node getNextNode() {
		return nextNode;
	}

	public void setNextNode(Node nextNode) {
		this.nextNode = nextNode;
	}
	public String toString(){
		return dataItem + "";
	}

}

public class LinkedListQueueDriver {

	public static void main(String [] args){
		LinkedListQueue l = new LinkedListQueue(5);
		l.add(1);
		l.add(5);
		/*l.add(6);
		l.add(10);*/
		//l.printQueue();
		/*l.add(11);
		l.remove();
		l.remove();*/
		//l.printQueue();
		/*l.remove();
		l.add(6);
		l.printQueue();*/
	}
}

these is one of the classes that give me that exception when i debug it...ClassNotFound..... it doesn't even leave my driver class...LinkedListQueueDriver .. please tell me what i am doing wrong!:(

could you give the entire exception message? what class doesn't he find, ...
also, in your previous post, it looks like you have all your classes in one file, you might want to edit that into three code blocks to make it easier to read

i do not get any messege when i run it. It just does not do anything. Its when i debug it (using the debugger) that i see its the 'ClassNotFoundException<Throwable> ....I dont knw what it wrong, cause its happening a lot more often..
The three classes are in three files...if there is any way i can make it better here , it would be nice if u let me know how i can do it cause i thought i was doing it right :):)... thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.