Hi,
I created a class named Test.java

public class Test {
	public Test() {
		System.out.println("Testing......");
	}
}

It sucessfully compiles.
Then i create another java class Menu.java and here i trying to create an object of the Test class.

class Menu {
	
	public static void main(String[] args) {
	
		Test arrList = new Test();
		
	}
}

I got an error "Test cannot resolved to a type error " while i compile the Menu.java
I am new to java
Anyone can help ?
Thanks in advance.

You need to have both the class files in a same folder. The error means I couldn't resolve(find) the Type Test Class.

Yes,it aleady resides the same folder.but the iuuse will come.
Please find the attached files

Do you have both the .class files and the java files in the same folder?
Test.java, Test.class, Menu.java, Menu.class ? I checked the code and it is correct.

The difference is that I have declared a package. The code should work without one. But is is better to use one. The right way would be to declare a package and set to the classpath the location of that package.

Can you verify at least that all of the above files mentioned are in the same folder?

Menu.class is not there,rest is there.
I got the above specified error while i am trying to compile Menu.java.
OS using : Linux

No one have any idea about it ?
Hope this is a small error ?
Can any one help me ?

Have you tried to declare a package at those classes?
Don't forget to set the classpath as well. There are instructions you can follow. Look at the tutorials at the top of the java forum

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.