compile error

Ads
 

compile error

Hello All

for example

public class A
    {
  static void main(String args[])
     {
System.out.println("Hello World");
     }
}

i have save this program with A.java. Then I executed this program javac A.java no errors and java A [output Hello World],up to this fine. Then I saved the same program with Test.java and try to compile with javac test.java an error like test.java :2 : class A is public ,should be declared in a file named A.java public class A ^

but if i remove public before class then the test.java is compiled.

so my question is why it is not compiled when the class declared as public,and why it compiled when class not declared as public.

what's the actual process is done when class declared as public and not as public.

please any one reply to this.

View Answers

Ads









Related Tutorials/Questions & Answers:
compile error
program with Test.java and try to compile with javac test.java an error like...compile error  Hello All for example public class A { static void main(String args[]) { System.out.println("Hello World
Compile time error
Compile time error  Hi, When i compile my simple program in cmd am getting a error like "Javac is not a recognized as an internal or external command, operable program or batch file" How to resolve this problem ????  
Advertisements
compile time error
compile time error  my program compile successfully and make the class file also but when i tried to do next command to see the output,it showing error that "could not find or load main class fibbo" fibbo is my class name
compile time error
compile time error  my program compile successfully and make the class file also but when i tried to do next command to see the output,it showing error that "could not find or load main class fibbo" fibbo is my class name
compile time error
compile time error  my program compile successfully and make the class file also but when i tried to do next command to see the output,it showing error that "could not find or load main class fibbo" fibbo is my class name
i got an error while compile this program manually.
i got an error while compile this program manually.  import javax.servlet.http.*; import org.apache.struts.action.*; public class ActionOne{ public...,struts jar files and i got an error in saveErrors() error Heading cannot find
compile
compile  how to compile .class files using eclipse
compile
compile  how to compile a java program using jre7
ModuleNotFoundError: No module named 'compile'
, ModuleNotFoundError: No module named 'compile' error will be solved...ModuleNotFoundError: No module named 'compile'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'compile'
, ModuleNotFoundError: No module named 'compile' error will be solved...ModuleNotFoundError: No module named 'compile'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
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
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 = /^\d{3,5
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
ModuleNotFoundError: No module named 'compile_test'
;compile_test' error? Thanks   Hi, In your python...;compile_test' error will be solved. Thanks...ModuleNotFoundError: No module named 'compile_test'  Hi, My Python
ModuleNotFoundError: No module named 'crytic-compile'
'crytic-compile' error? Thanks   Hi, In your python... 'crytic-compile' error will be solved. Thanks...ModuleNotFoundError: No module named 'crytic-compile'  Hi, My
ModuleNotFoundError: No module named 'req-compile'
;req-compile' error? Thanks   Hi, In your python environment...ModuleNotFoundError: No module named 'req-compile'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'compile_test'
;compile_test' error? Thanks   Hi, In your python...;compile_test' error will be solved. Thanks...ModuleNotFoundError: No module named 'compile_test'  Hi, My Python
ModuleNotFoundError: No module named 'crytic-compile'
'crytic-compile' error? Thanks   Hi, In your python... 'crytic-compile' error will be solved. Thanks...ModuleNotFoundError: No module named 'crytic-compile'  Hi, My
ModuleNotFoundError: No module named 'pip-compile'
;pip-compile' error? Thanks   Hi, In your python environment...ModuleNotFoundError: No module named 'pip-compile'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named

Ads