my Ubuntu desktop is not recognizing the class file present in the same directory

Viewed 28

I have created Folder class called "DependencyDemo-java" inside it i have two java file as follows

A.java

public class A
{ 
  int a; 
  A(){  
   a=10;
  }
}

B.java

public class B
{
   B(){
    A obj=new A(); 
  }
}

I Compiled A.java first it compiles fine. then i'm trying to compile B.java. Both file are present in the same directory but i got error while compiling B.java

B.java:7: error: cannot find symbol
      A obj=new A();    
      ^
  symbol:   class A
  location: class B
B.java:7: error: cannot find symbol
      A obj=new A();    
                ^
  symbol:   class A
  location: class B
2 errors

Now what i do to compile the B.java? and why this error?

0 Answers
Related