0% found this document useful (0 votes)
175 views6 pages

Practice Module 1 PDF

This document provides an introduction to object-oriented programming in Java. It discusses setting up the Java development environment and PATH variable on Windows. It then presents two practice tasks - creating a simple "Hello World" Java program, and a second program that outputs the student's personal data. The document instructs saving files to a specific directory and creating a report analyzing what would happen if the second program's class name was changed.

Uploaded by

artha rezky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views6 pages

Practice Module 1 PDF

This document provides an introduction to object-oriented programming in Java. It discusses setting up the Java development environment and PATH variable on Windows. It then presents two practice tasks - creating a simple "Hello World" Java program, and a second program that outputs the student's personal data. The document instructs saving files to a specific directory and creating a report analyzing what would happen if the second program's class name was changed.

Uploaded by

artha rezky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

OOP Practice / MC

Practice Module 1
Introduction to Object Oriented Programming

1. Objectives
Students have ability to use netbeans as an editor and execute simple Java program.

2. Basic Theory
Java is flexible language programming that we can say that it has motto as WORA (Write Once
Run Anywhere). We can develop in any platform and run it in any other platform. First off all,
we can do this steps before having our first program by Java.

 Check the PATH first, by click the Start Menu than right click in the My Computer and
choose Properties.

 Choose Advanced System Settings

https://introcs.cs.princeton.edu/java/15inout/windows-cmd.html Page 1
OOP Practice / MC

 Click Environment Variables button

 We can see C:\Program Files\Java\jdk1.8.0_121\bin; to the beginning of the PATH


variable.

 If not yet then do the following steps :

 Click New button

https://introcs.cs.princeton.edu/java/15inout/windows-cmd.html Page 2
OOP Practice / MC

 Fill the variable value like in the image, but adjust to where you install Java then
click OK twice.

 Second step is opening the Command Prompt by click Start Menu – All Programs –
Accessories – Command Prompt or Start – Run – type cmd then click OK.

https://introcs.cs.princeton.edu/java/15inout/windows-cmd.html Page 3
OOP Practice / MC

3. Practice Task
1. Create your first simple program.
Open your notepad, then type this code :

Save your code to your directory with name MyFirstJava.java, choose All Files as shown
below :

To run the program:


Use command prompt, go to your directory as shown below :

Type D: then enter.

https://introcs.cs.princeton.edu/java/15inout/windows-cmd.html Page 4
OOP Practice / MC

Type cd P1_NIM then enter

Then compile your java file by type javac MyFirstJava.java on your command prompt
then enter.

If there is no error there, then we could execute the file by type java MyFirstJava then
enter and the output should be shown below :

Congratulations, your first program is successful.

https://introcs.cs.princeton.edu/java/15inout/windows-cmd.html Page 5
OOP Practice / MC

2. Base on the steps above, in the same directory, create class mydata that are show your
own data.
For example
Name : Adi Santoso
NIM : 123456789
Address : Jl. Ahmad Yani No. 1 Batam Centre
No HP : 08123456789

3. What happens if the classname of the program "mydata" was changed to "data"? Write down
your analysis of the program. Draw conclusions from what you have learned from this lab.

Save your report with name P1_NIM.doc and your java files to your directory with name P1_NIM
in zip.

https://introcs.cs.princeton.edu/java/15inout/windows-cmd.html Page 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy