java compiler error

java compiler error

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.

View Answers

August 22, 2012 at 9:31 PM

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

Ads









Related Tutorials/Questions & Answers:
java compiler error
java compiler error  I am trying to compile a simple program which is as follows: public class A { public static void main(String args... as well.But putting class B in different file named B.java compiler complains about
Java error cannot find symbol
Whenever a Compiler does not recognize a class name, Java displays an error... the java error cannot find symbol. In this example a class name 'cannot find... not recognize a variable “z” and displays an errorJava error
Advertisements
java compiler
java compiler  how we can convert .java file to a .class file without using javac
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
Java Compiler
Java Compiler       ... to tell you about the Java Compiler which is used to compile the Java program into byte code. The Java program (.java) file is checked for syntax error
Compiler errors in java
Compiler errors in java  Hi, I used GenerateRDF java file. Am getting errors when i run this code. I used command prompt only. getting errors as no package exist. i followed your instructions properly. Please help me out
What is the right compiler for a java beginner?
What is the right compiler for a java beginner?  Hi, Which compiler I should use to compile my Java program? What is the right compiler for a java... and running your Java program. Check the tutorial: What is the right compiler
What is the right compiler for a java beginner?
What is the right compiler for a java beginner?  Hi, Which compiler I should use to compile my Java program? What is the right compiler for a java... and running your Java program. Check the tutorial: What is the right compiler
Java Compiler,Java Compiler Example
Java Compiler      ... Compiler. When we write any program in a text editor like Notepad, we use Java compiler to compile it. A Java Compiler javac is a computer program or set
Java Compiler
Java Compiler       To commence with Java programming, we must know the significance of Java Compiler. When we write any program in a text editor like Notepad, we use Java compiler
Java Compiler
Java Compiler       To commence with Java programming, we must know the significance of Java Compiler. When we write any program in a text editor like Notepad, we use Java compiler
runtime error in java
runtime error in java  What is Run time error in Java?   Run time error is a syntax error that during the execution of a program.It hash different types of a program like as Logic error,Fatal Errors,source code,wrong
pointer error java
pointer error java  How to catch null pointer errors in java if the if(value != null) or null
JAVA Annotation Error
JAVA Annotation Error  while compiling simple java program i get annotation error i.e class will only be accepted if annotation processing is explicitly requested..how to solve
compilation error - Java Beginners
this program it is giving an error as integer number is too large.why? and what is the reason?  Hi Friend, In Java there are some specific literal... not in the Hexadecimal or Octal. Here is fraction of Java code example which will help you
which package imported by the java compiler by default?
which package imported by the java compiler by default?  which package imported by java by default
java compilation error - Hibernate
java compilation error  hi, i have made an registration page whosevalues should be inserted into database. i have used hibernate and eclipse it is working fine. but when i make a war file and deploy it using ant and then run
Java error stream
Java error stream       The Java error stream is used to print error that arises during... In this Tutorial we want to describe you a code that help you to understand java error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern

Ads