
I am trying to compile a simple program which is as follows:
public class A {
public static void main(String args[])
{
B b=new B();
}
}
Above program is in file A.java
second program is in file B.java which is as follows:
public class B { public B() { System.out.println("hello"); } }
compiling A.java there are two errors of can not find symbol: B(pointing below this B) b=new B();
and
B b=new B(pointing below this B)();
I am using windows 7:
when i include both programs A and B inside same file A.java it compiles fine and run as well.But putting class B in different file named B.java compiler complains about not finding class B as explained above. Please help me to find what is wrong with this simple program.

SAME HERE IF YOU GET THIS PROBLEM SOLVED THEN PLEASE REPLY......... MY ONE JAVA FILE IS:
abstract class A {
abstract void callmetoo() { System.out.println("anoop"); } }
ANOTHER FILE IS:
class B extends A { void callme() { System.out.println("an"); } }
AND THIRD ONE IS:
class AbstractDemo { public static void main(String args[]) { B b1=new B();
b1.callmetoo(); } }
WHEN I AM COMPILING javac AbstractDemo.java,I receives en error: AbstractDemo.java:5:cannot find symbol symbol: class B location: AbstractDemo B b1=new B(); ^ B b1=new B(); ^ 2 errors...
PLEASE REPLY SOON
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.