How to run a program in Java
Answers
Answer:
- Open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram.java). Assume it's C:\.
- Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).
- Now, type ' java MyFirstJavaProgram ' to run your program.
- You will be able to see the result printed on the window.
please mark as brainliest
How to run a program in Java ?
If you are using BlueJ IDE compiler, then u can do it by the following steps:
- Write the program by creating an object of tha class. For example take => PUBLIC STATIC VOID MAIN(STRING ARGS []).
- EXIT THE PROGRAM.
- Right click on the class menu and click on the object created as above.
- A dialog box will appear.
- Type {} in it and hit Enter key.
//author :@Dark_Panther(Yash Raj)
import java.util.*;
public class Calculator
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
double a,b,c,d,e,f;
System.out.print("Enter two integers : ");
a=sc.nextDouble();
b=sc.nextDouble();
c=a+b;
d=a-b;
e=a*b;
f=a/b;
System.out.println("Sum="+c);
System.out.println("Difference="+d);
System.out.println("Product="+e);
System.out.println("Quotient="+f);
}
}
IF U WANT CODING IN ANDROID
PHONES, I WOULD RECOMMEND YOU TO
DOWNLOAD JVDROID OR DCODER FROM
PLAY STORE......
Follow me if you want continued help on Java.....
Like u I am also highly intrested in Java and Computer is my favourite subject......
#BAL
#AnswerWithQuality