java compiler error

Ads
 

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 compiler
java compiler  how we can convert .java file to a .class file without using javac
Advertisements
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
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
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 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
pointer error java
pointer error java  How to catch null pointer errors in java if the if(value != null) or null
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
Java compilation error - Java Beginners
Java compilation error  Method overridden problems in compile time error
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
java compilation error - Java Beginners
java compilation error  i have downloaded java software(version 6... command, error message is displayed javac is not recognized as an internal... from where i should download java or what to do now?  Have you set
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
Online Java Compiler
Online Java Compiler provides the Java development environment online, which... is a competitive online Java compiler. Using Online Java Compiler you can instantly start..., Ruby etc. Online Java compiler and runner are basically a Java compiler
Java code error - Java Beginners
Java code error  Hi, I am using a MooreQuery to look for neighbors in a grid: MooreQuery query = new MooreQuery(grid, this,(int) (2*myHomeRangeRadius), (int) (2*myHomeRangeRadius)); if(query != null){ for (Object
Java Code Color Function Error
Java Code Color Function Error  Java Code Color Function Error
Java error cannot find symbol
Java error cannot find symbol In this section you will learn about "cannot find symbol" in java. Java cannot find symbol is a type of error occurs... system.out.println() will confuse compiler and give error cannot find symbol because
Java Error
Java Error      ... that occurs in a program. Error in java is a subclass of the Throwable class.... Most of the errors in java are abnormal conditions while the error ThreadDeath
Error during runtime NoClassDefFound in java
:\jama-1.0.2>java EigenvalueDecomposition now it gives NoClassDefFound Error. pls...Error during runtime NoClassDefFound in java  code: package Jama...[n-1][n-1] - H[n][n]) / 2.0; q = p * p + w; z
Error during runtime NoClassDefFound in java
:\jama-1.0.2>java EigenvalueDecomposition now it gives NoClassDefFound Error. pls...Error during runtime NoClassDefFound in java  code: package Jama...[n-1][n-1] - H[n][n]) / 2.0; q = p * p + w; z
XML DOM error - Java Beginners
) but im getting a error like this... "java.io.IOException: Server returned HTTP... got the error again,then send full error details. Thanks
Error Handling in Java Script
Error Handling in Java Script  ... will Learn how to handle error in java script. JavaScript is scripting language used for client side scripting. and error are handling in two ways.   *try
Array list in Java - arraylist type error
Array list in Java - arraylist type error  I am using Array list in Java but when i compile i get array list type error. Can anyone please explain what is array list type error and why it occurs
Command Line Standard Error In Java
Command Line Standard Error In Java In this section we will discuss about the Command Line Java IO Standard Error. System.out and System.err both... is provided by Java for printing of error messages. System.err In System.err, err
java profram:error 405 method not found
java profram:error 405 method not found  import javax.servlet.http.*; import javax.servlet.*; import java.io.*; public class Configservlet extends HttpServlet { ServletConfig con; ServletContext ctx; public void
java lang incompatibleclasschangeerror quartz spring - Error resolved
java lang incompatibleclasschangeerror quartz spring - Error resolved ... application. On startup it gives following error: Caused.... How to resolve this error? Thanks   Hi, Spring web framework

Ads