Computer Science, asked by shaw0806, 10 months ago

How to run a program in Java ​

Answers

Answered by sudhanshus5694
2

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

Answered by yash197911
2

\large\boxed{\mathbf{\black{\underline{\overline{\bigstar |\:JAVA\:EXPERT|\: \bigstar}}}}}

\huge\boxed{\mathfrak{\red{\underline{\underline{QUESTION: }}}}}

How to run a program in Java ?

\huge\boxed{\mathfrak{\blue{\underline{\underline{ANSWER:}}}}}

If you are using BlueJ IDE compiler, then u can do it by the following steps:

  1. Write the program by creating an object of tha class. For example take => PUBLIC STATIC VOID MAIN(STRING ARGS []).
  2. EXIT THE PROGRAM.
  3. Right click on the class menu and click on the object created as above.
  4. A dialog box will appear.
  5. Type {} in it and hit Enter key.

\large{\mathcal{\red{\underline{\underline{EXAMPLE\:PROGRAM:}}}}}

//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......

<body bgcolor="mistyrose"><marquee scrollamount="10">Hope You Get Helped</marquee></body>

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

Similar questions