






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Java How To Program
Typology: Study notes
1 / 12
This page cannot be seen from the preview
Don't miss anything!







Author Hassan Shahzad Aheer
Faculty Computer Science
Email [email protected]
Personal Details
Student Name Hassan Shahzad Aheer Roll # 15SBSCS
Department : Computer science
Section 2 A
Assignment Detail : Assignment Title : Java Programming Manuals Project Type : - Subject Name or Code : CS 10 2 Object Oriented Programming Coordinator or Tutor : Abdul Hafeez Khan Manual # 01 Due Date : Submission Date : Signature :
Experiment # 1
To implement the basic concepts of Net Beans.
Students will be able to understand the basic concept of Net Beans usage.
1.1 Setting Up the Project
In the Name and Location page of the wizard, do the following
(as shown in the figure below):
In the Project Name field, type HelloWorldApp. Leave the Use Dedicated Folder for Storing Libraries checkbox unselected.
1.2 Adding Code To Your Generated Source File
Because you have left the Create Main Class checkbox selected in the New Project
wizard, the IDE has created a skeleton main class for you. You can add the "Hello
World!" message to the skeleton code by replacing the line:
Save the change by choosing File > Save.
The file should look something like the following code sample.
package helloworldapp; /**
/**
}
1.3 Compile And Running The Program
Because of the IDE's Compile on Save feature, you do not have to manually compile
your project in order to run it in the IDE. When you save a Java source file, the IDE
automatically compiles it.
The Compile on Save feature can be turned off in the Project Properties window.
Right-click your project, select Properties. In the Properties window, choose the
Compiling tab. The Compile on Save checkbox is right at the top. Note that in the
Project Properties window you can configure numerous settings for your project:
project libraries, packaging, building, running, etc.
Press Shift + F6 to run your program or click on run button
The next figure shows what you should now see.
Congratulations! Your program works! If there are compilation errors, they are marked with red glyphs in the left and right margins of the Source Editor. The glyphs in the left margin indicate errors for the corresponding lines. The glyphs in the right margin show all of the areas of the file that have errors, including errors in lines that are not visible. You can mouse over an error mark to get a description of the error. You can click a glyph in the right margin to jump to the line with the error.
*/
boolean bool = false; char ch = 'a'; byte by = 26; int in = 86; float fl = 89.6F; double dou = 77.8; String name = "SMIU University";
// display the out put of the datatypes System.out.println("Boolen : " +bool); System.out.println("Char : "+ch); System.out.println("byte : "+by); System.out.println("Integer : "+in); System.out.println("Float : "+fl); System.out.println("Double : "+dou); System.out.println("String : "+name);
} }
perform following arithmetic operations (+, - , *, /)?
*/
// define variable for store the user input int a, b;
// to create object of scanner class // which help us to take input form user Scanner input = new Scanner(System.in);
// prompt to user for input System.out.print("Enter 1st Number : ");
// get input form user and store in variable called a a = input.nextInt();