CourseHero2

.docx

School

Glendale Community College *

*We aren’t endorsed by this school

Course

MISC

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

2

Uploaded by reraj51807

Report
CIS18A Unit 1 Lab: JDK, Virtual Machine and Running Java Programs. In this lab, you will install SDK, Virtual Machine and run basic Java Program. Complete the following steps and provide answers or screen captures as required. These instructions are implemented for IDE. See IDE information in course module if you want to use IDE for this course. Referencing Documentation and Review Install Guide To begin, visit https://www.oracle.com/java/technologies/javase-jdk11-downloads.html ** Note: You can use JDK 12 – 15. Be sure to review documentation for the selected version. Select the appropriate download type for your computer operating system. If you are using Windows PC for this course, download Windows x64 installer and complete Part A If you are using macOS for this course, download macOS installer and complete Part B. If you are using Linux OS for this course, download Linux RPM package and complete part C. Part A: Running Java Program in Windows PC – Windows 10 or 8 You need to set Environment Variables. See Setting Environment Variables Section for details https://docs.oracle.com/en/java/javase/11/install/installation-jdk-microsoft-windows- platforms.html#GUID-E3C75F92-D3B2-421D-A9BE-933C15F7CD1B In Search, search for and then select: Control Panel In Control Panel, click System and Security (category), then select System applet. Click the Advanced system settings link (on left) Click Environment Variables (on bottom of tab). In the section System Variables on the bottom section, find the PATH environment variable and select it. Click New. Return to System variables find PATH and select it. Click Edit In the Edit System Variable window, click New button specify the value %JAVA_HOME%. Click OK. Close all remaining windows by clicking OK. Open Command Prompt, in Windows 10 or 8.1, type cmd into the search bar of the Start menu. Click on Command Prompt to open the application. In command prompt input javac -version then press Enter key. Take a screen capture showing that you have installed Version 11.0.5 on the PC. *To take screen capture, press Alt and PrtSc (on upper right of keyboard). Paste the captured image to a document that your answers from question 3 for later submission. Open Notepad and create your first Example.java file. See below: Save file as Example.java to Desktop. *Note: “Example” as typed in file name must match class in code. Otherwise, you will get an error. Return to Command Prompt and input cd desktop then press Enter key In command prompt, input javac Example.java then press Enter key. At this point, you are compiling the program. Notice that you will find Example.class on the desktop once the program is compiled. In Command Prompt, input java Example then press Enter key. Take a screen capture showing text display in Command Prompt.
In Notepad (Windows) create Example2.java file as shown below: Repeat steps 14 – 18 to compile and run Example2 program. Take a screen capture showing command line contain displayed text as programmed. Review the Example2 program and answer the following questions: What is the assigned and output value of variable myVar1? 1204 What is the output value of variable myVar2? 512 is the output variable of myVar2 Repeat the steps to create and compile Example3.java as shown below: Take a screen capture showing the displayed output in command line of Example3. Review the Example3 and answer the following questions: What is the primary difference in variable v and variable x declaration? How do the data type and assignment impact the output of the program? Repeat the steps to create and compile GaltoLit.java as shown below: Take a screen capture showing output in command line of GalToLit program. Review the output and program code to answer the following questions: What are the variables in this program? What data type are used in variable declaration of the program? What happen if the int is used instead of double? Save your document that contains answers and screen captures. Submit the document (.docx or .pdf) that contains answer and screen captures to Lab 1 on Canvas Unit 1 Module.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help