Page 26 - CTS - CSA TP - Volume 2
P. 26
COMPUTER SOFTWARE APPLICATION - CITS
EXERCISE 81 : Use various data types in JAVA
Objectives
At the end of this exercise you shall be able to
• develop Java Programs with various data types
• Compile , Execute and verify the result of the Java Programs.
Requirements
Tools/Materials
• PC/Laptop with Windows OS
• JDK Software
• Text Editor (Visual Studio/Sublime/Notepad)
Procedure
TASK 1: Write a Java program to declare variables of different primitive data types and print their values
Step 1: Writing the Java Program to display various data type values.
1 Open a Text Editor:
• Open a text editor such as Notepad, Notepad++, Visual Studio Code, or any other text editor of your choice.
2 Write the Java Code:
3 Save the File: Save the file with the name PrintDataTypes.java
Step 2: Compiling the Java Program
1 Open Command Prompt (cmd):
Press Win + R, type cmd, and press Enter to open the Command Prompt.
2 Navigate to the Directory:
Use the cd command to navigate to the directory where PrintDataTypes.java is saved.
11
CITS : IT & ITES - Computer Software Application - Exercise 80