Download presentation
Presentation is loading. Please wait.
1
Computers & Programming Languages
2
Use char and Boolean variables
Primitive Data Type Char - Boolean Lesson1- Objectives Use char and Boolean variables
3
Data Type أنواع البيانات
Primitive Data Types integer byte short int long Floating Point float double character char Boolean boolean
4
To represent any single character, letter, digit & special symbol.
When and how to use char data type ? To represent any single character, letter, digit & special symbol. ‘F’, ‘M’, ‘$’, ‘0’ Should be enclosed with a single quotation mark ‘ ‘
5
char data type declaration
System.out.println(“Enter a character”); Scanner c1 = new Scanner (System.in); name= c1.next().charAt(0); int data type declaration System.out.println(“Enter the number”); Scanner c1 = new Scanner (System.in); num = c1.nextInt(); int num; num=5; int num=5;
6
Example P
7
Activity in your book P-208
Open a new program and type the program in page 208 Modify your program as requested in question 2 ??
8
Boolean data type declaration
To represent two logical values , true or false Boolean data type declaration Boolean x; X = true; Boolean x = true;
9
Activity in your book P-209
10
Book Activity Page 211 Questions 1 - 3
11
Q4 + Practical Activity (1)
Activity in your book P-212 Q4 + Practical Activity (1)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.