0% found this document useful (0 votes)
5 views2 pages

Lab 1 2

This document is a lab guide for programming in Java using the NetBeans IDE, aimed at engineers. It includes instructions for setting up the Java Development Kit and creating simple Java programs, such as 'Hello, World!' and a program that prints multiple lines. The lab concludes with a task to screenshot the output and submit it via email.

Uploaded by

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

Lab 1 2

This document is a lab guide for programming in Java using the NetBeans IDE, aimed at engineers. It includes instructions for setting up the Java Development Kit and creating simple Java programs, such as 'Hello, World!' and a program that prints multiple lines. The lab concludes with a task to screenshot the output and submit it via email.

Uploaded by

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

Programming for Engineers- lab 1

Programming for Engineers


Lab (1) – Java start up
This lab sheet guides you through writing simple Java programs using the NetBeans
IDE, introducing fundamental concepts.

Before you begin:

 Install and configure Java Development Kit (JDK)


from https://www.oracle.com/java/technologies/downloads/.

 Download and install NetBeans IDE


from https://netbeans.apache.org/downloads/.

Exercise 1: Hello, World! in NetBeans

1. Open NetBeans and create a new project:

o Select "Java" -> "Java Application"

o Name your project "HelloWorld" and choose a location.

o Click "Finish".

2. In the "Projects" tab, right-click your project and select "New" -> "Java Class".

o Name the class "HelloWorld" and click "Finish".

3. The generated class file opens in the editor. Replace the existing code with:

4. Run the program:


o Click the "Run" button (green triangle) on the toolbar.
o Alternatively, right-click on the "HelloWorld" class and select "Run File".
5. You should see the output "Hello, World!" in the "Output" window.

Page 1 of 2
Programming for Engineers- lab 1

Congratulations! You've created your first Java program in NetBeans!

Exercise 2: Printing Multiple lines

1. In the "Projects" tab, right-click your project and select "New" -> "Java Class".

o Name the class " SimpleJavaProgram " and click "Finish".

public class SimpleJavaProgram


{
public static void main(String[] args)
{
System.out.println("My first Java program.");
System.out.println("The sum of 2 and 3 = " + 5);
System.out.println("7 + 8 = " + (7 + 8));
}
}

2. Run the program:


o Click the "Run" button (green triangle) on the toolbar.
o Alternatively, right-click on the "HelloWorld" class and select "Run File".

Screenshot the screen and save in a Word


document. Send them to the given Email.

Page 2 of 2

You might also like