answersLogoWhite

0


Best Answer

One of them is creating *.class from *.java

Second is identifying syntax errors in the *.java files and intimating the programmer so that he can correct them

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Check the program, written in source code, for errors. If there are none, convert it to a compiled program. In the case of Java, this compiled program is called "bytecode", and is supposed to be run in a JVM (Java Virtual Machine).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are two main purposes of the Java compiler javac?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the main feature of the programming language Java Classpath?

Java Classpath is a parameter that tells the Java Virtual Machine or the Java Compiler, where to search for user-defined classes and packages on a computer.


Why path and class-path in java?

1))What is the difference between "path" and "classpath"? Ans:: We keep all "executable files"(like .exe files) and "batch files"(like .bat) in path variable. And we keep all jar files and class files in classpath variables. So path is set according to the .exe files & .bat files And classpath is set according to the .jar files & .class files. Operating system tries to find .exe and .bat files in path and JVM tries to find all classes in classpath.


Examples of codes in java?

public class Hello{//opens the classpublic static void main(String args[]){//opens the main methodSystem.out.println("Hello World");}//closes the main method}//closes the classNote: The compiler all the sentences that have "//" before them.


Give sample program?

class firstprog { public static void main (String args[]) { System.out.pritnln("My first Program in Java "); } } Simple Java Programe Write the above program in Ms dos's edit or Notepad of Windows save it with "firstprog.java" run the commands given below in command prompt of Ms Dos to get the output Remamber Java is case sensative so mentain capital and small letter. 1. javac firstprog.java 2. java firstprog


How to write java program without using main method?

Java program without mainWe need a main method for executing a program.But YES we can write a program without using main() method.TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main methodWhoa!!!!! we are done.;)

Related questions

What is the main feature of the programming language Java Classpath?

Java Classpath is a parameter that tells the Java Virtual Machine or the Java Compiler, where to search for user-defined classes and packages on a computer.


How do you compile java servlet?

The Java Servlet is like every other Java class. You can compile it using the javac command or if you are using a Integrated Development Environment (IDE) like Eclipse, it will compile the class for you. One main difference w.r.t Servlets is the fact that, they get deployed into EAR files (Enterprise Archive Files) and not JAR files (Java Archive Files) like normal java apps.


Why path and class-path in java?

1))What is the difference between "path" and "classpath"? Ans:: We keep all "executable files"(like .exe files) and "batch files"(like .bat) in path variable. And we keep all jar files and class files in classpath variables. So path is set according to the .exe files & .bat files And classpath is set according to the .jar files & .class files. Operating system tries to find .exe and .bat files in path and JVM tries to find all classes in classpath.


Examples of codes in java?

public class Hello{//opens the classpublic static void main(String args[]){//opens the main methodSystem.out.println("Hello World");}//closes the main method}//closes the classNote: The compiler all the sentences that have "//" before them.


Why java not support operator overloading?

Maybe because Sun said so. We have to bear with so many other idiosyncrasies too. But I guess that comes with every language. There were two major reasons why operator overloading wasn't allowed in Java: "cleanliness" and compiler complexity. The main reason was the first, a personal preference choice made by Java's creator, James Gosling. Operator overloading, while useful, can be exceedingly confusing, much more so than method overloading. Given the human tendency to assign specific meanings to single symbols, it is hard to get programmers to wrap their heads around multiple meanings for operators. What this means is that there is a marked increase in programming errors when a language supports operator overloading. Since practically the same benefit can be obtained via methods, the Java designers decided that the increased programmer mistake rate was not worth supporting operator overloading. From a Java compiler (e.g. javac) design standpoint, supporting operator overloading is considerably more difficult than method overloading, requiring a more complex compiler.


Why main is used in java?

In java need main() method. without main() in java we won't run the java programe main() signals the entry point to the program - it tells the Java Virtual Machine which is the first program that should be executed.


How to write java program without using main method?

Java program without mainWe need a main method for executing a program.But YES we can write a program without using main() method.TRICK 1 of 2 :: while writing applets in java we don't use main... we use init() method instead.TRICK 2 of 2 :: using 'static' we can write a program whic will execute successfully and output the desired message on screen. Here it is :: class Mohit{ static { System.out.println("This java program has run without the main method"); System.exit(0); } } -->save the program as Mohit.java to compile::javac Mohit.java (in command prompt) to run ::java Mohit(command prompt) output will be ::This java program has run without the main methodWhoa!!!!! we are done.;)


Why the name of a java file is same as the name of the public class?

It is not compulsory that the java file name and name of the public class should be same. if u will give java file name and public class name different then u have to compile and run the program with another names. for example: u have named class sample i.e. (public class sample) and main function is also defined in this class. and u have saved the file as abc.java then u will first comple the file as: javac abc.java now run the file (type java class name(in which main function is defined) i.e. java sample try it.


Give sample program?

class firstprog { public static void main (String args[]) { System.out.pritnln("My first Program in Java "); } } Simple Java Programe Write the above program in Ms dos's edit or Notepad of Windows save it with "firstprog.java" run the commands given below in command prompt of Ms Dos to get the output Remamber Java is case sensative so mentain capital and small letter. 1. javac firstprog.java 2. java firstprog


Why the compiler start its execution from main function?

i think as the compiler bind all the functions and source code starting from main hence all that make the compiler directed to execute it from the very same point


Who invoke main function in java?

The Java Runtime Environment invokes main methods.


Which api used in java?

The Java API is the API for the main Java Library.