Here is a calculator program I had to make in my Computer class in bluej (free java compiler)
import java.io.*;
import java.util.*;
public class Calculator
{
public static void main(String args[])
{
System.out.println("Make your arithmetic selection from the choices below:\n");
System.out.println(" 1. Addition");
System.out.println(" 2. Subtraction");
System.out.println(" 3. Multiplication");
System.out.println(" 4. Division\n");
System.out.print(" Your choice? ");
Scanner kbReader = new Scanner(System.in);
int choice = kbReader.nextInt();
if((choice<=4) && (choice>0))
{
System.out.print("\nEnter first operand. ");
double op1 = kbReader.nextDouble();
System.out.print("\nEnter second operand.");
double op2 = kbReader.nextDouble();
System.out.println("");
switch (choice)
{
case 1: //addition
System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) );
break;
case 2: //subtraction
System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) );
break;
case 3: //multiplication
System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) );
break;
case 4: //division
System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) );
}
}
else
{
System.out.println("Please enter a 1, 2, 3, or 4.");
}
}
}
The command to compile a Java program is "javac", followed by the class name (file name).
In the same way as you would compile and execute any other Java program. Compile: use the "javac" command. Or use the built-in "compile" command in your favorite IDE. Execute: Use the "java" command. Or use the built-in "run" command in your favorite IDE.
Hello Frnd, As u say u want to Compile & Run Java Prog. for This if U have JAVA CREATOR then u can compile directly otherwise........ goto Start >run type "cmd" Press "Enter"after that goto C>java>bin> type for compile the prog. "javac PROG.NAME.java" Press "Enter" if Compile SuccessFully Type "java PROG.NAME" Press "Enter" For It This Is Must u save ur Prog. in the folder "bin" in java............. Hello Frnd, As u say u want to Compile & Run Java Prog. for This if U have JAVA CREATOR then u can compile directly otherwise........ goto Start >run type "cmd" Press "Enter"after that goto C>java>bin> type for compile the prog. "javac PROG.NAME.java" Press "Enter" if Compile SuccessFully Type "java PROG.NAME" Press "Enter" For It This Is Must u save ur Prog. in the folder "bin" in java.............
You use javac <filename> to compile a class or package.
Java Integrated Development Environment (IDE) provides an environment to Edit, compile and debug and generate java codeThere are several java IDE like Eclipse, WSAD, BlueJ, JCreator etc
You compile it.You compile it.You compile it.You compile it.
One can run and compile a Java applet program by agreeing to the terms and downloading it. It is possible to get a compiler online that will compile and run Java programs.
How can I compile java programs using windows vista text pad?
The command to compile a Java program is "javac", followed by the class name (file name).
Tomcat is a server. It is used to deploy and run Servlets and not compile them. A Servlet is a java file and has to be compiled just like any other Java Class.
HelloWorld.classrun it with command java HelloWorld
In the same way as you would compile and execute any other Java program. Compile: use the "javac" command. Or use the built-in "compile" command in your favorite IDE. Execute: Use the "java" command. Or use the built-in "run" command in your favorite IDE.
It should work, yes. It really doesn't matter where you compile it - if you compile under Windows XP, you don't compile FOR Windows XP; rather, you compile for the virtual machine, which is compatible in different environments.
Hello Frnd, As u say u want to Compile & Run Java Prog. for This if U have JAVA CREATOR then u can compile directly otherwise........ goto Start >run type "cmd" Press "Enter"after that goto C>java>bin> type for compile the prog. "javac PROG.NAME.java" Press "Enter" if Compile SuccessFully Type "java PROG.NAME" Press "Enter" For It This Is Must u save ur Prog. in the folder "bin" in java............. Hello Frnd, As u say u want to Compile & Run Java Prog. for This if U have JAVA CREATOR then u can compile directly otherwise........ goto Start >run type "cmd" Press "Enter"after that goto C>java>bin> type for compile the prog. "javac PROG.NAME.java" Press "Enter" if Compile SuccessFully Type "java PROG.NAME" Press "Enter" For It This Is Must u save ur Prog. in the folder "bin" in java.............
to compile and run java program you need to set path and classpath path refers to binary used to compile and run java program i.e. "javac" for compilation and "java" for execution
javac is the command that is used to compile Java source files.
by adding more documents