Compiling%20and%20Running%20a%20Java%20Program - PowerPoint PPT Presentation

About This Presentation
Title:

Compiling%20and%20Running%20a%20Java%20Program

Description:

1) Compile the program to generate the bytecode (executable -- .class) using javac : ... Use an editor to type in the new Java program below. ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 3
Provided by: csp19
Category:

less

Transcript and Presenter's Notes

Title: Compiling%20and%20Running%20a%20Java%20Program


1
Compiling and Running a Java Program 1) Compile
the program to generate the bytecode (executable
-- .class) using javac     gt javac
TempConverter.java 2) Interpret (run) the
bytecode (executable .class) using the java
interpreter     gt java TempConverter
Use an editor to type in the new Java program
below.  Note that the program name is
TempConverter, so, by the naming rules of Java,
your file name must be TempConverter.java.
?The class name must be the same filename. 
Start your editor (i.e. pico in UNIX or Notepad
on your PC or NetBeans)     Save the file as
TempConverter.java  
2
import java.util.Scanner public class
TempConverter public static void main (String
args) final int BASE 32 final
double CONVERSION_FACTOR 5.0 / 9.0
double celsiusTemp, fahrenheitTemp Scanner
scan new Scanner(System.in)
System.out.print ("Enter a Fahrenheit
temperature ") fahrenheitTemp
scan.nextDouble() celsiusTemp
CONVERSION_FACTOR (fahrenheitTemp - BASE)
System.out.println ("Celsius Equivalent "
celsiusTemp) Compile and run the code
using the java compiler and interpreter
commands. 
Write a Comment
User Comments (0)
About PowerShow.com